Total Pageviews

Saturday, June 6, 2020

DEPT_LOCATION TABLE DATA INSERTION (COMPANY DATABASE NAVATHE BOOK)


DEPT_LOCATION TABLE DATA INSERTION (COMPANY DATABASE NAVATHE BOOK)

PROJECT TABLE DATA INSERTION (COMPANY DATABASE NAVATHE BOOK)

PROJECT TABLE DATA INSERTION (COMPANY DATABASE NAVATHE BOOK)


EMPLOYEE TABLE DATA INSERTION ( COMPANY DATABASE NAVATHE BOOK)

EMPLOYEE TABLE DATA INSERTION ( COMPANY DATABASE NAVATHE BOOK)

1. 1ST PART

2 . 2ND PART


DATA INSERTION COMPANY DATABASE NAVATHE BOOK

DATA INSERTION IN  TABLE :

1.  DEPARTMENT --  CLICK

2.  EMPLOYEE -- CLICK

3.  DEPT_LOCATIONS -- CLICK

4.  PROJECT -- CLICK

5. WORKS_ON -- CLICK

6. DEPENDENT --   CLICK

DEPARTMENT TABLE DATA INSERTION ( COMPANY DATABASE NAVATHE BOOK )

DEPARTMENT TABLE DATA INSERTION ( COMPANY DATABASE NAVATHE BOOK )


DEPENDENT TABLE CREATION:: ( NAVATHE BOOK DATABASE )

DEPENDENT TABLE CREATION:: ( NAVATHE BOOK DATABASE )









WORKS_ON TABLE CREATION:: ( NAVATHE BOOK DATABASE )


 WORKS_ON TABLE CREATION:: ( NAVATHE BOOK DATABASE )






DEPT_LOCATIONS TABLE CREATION:: ( NAVATHE BOOK DATABASE )

DEPT_LOCATIONS TABLE CREATION:: ( NAVATHE BOOK DATABASE )






PROJECT TABLE CREATION:: ( NAVATHE BOOK DATABASE )

PROJECT TABLE CREATION:: ( NAVATHE BOOK DATABASE )







ALTER DEPARTMENT TABLE :: ( NAVATHE BOOK DATABASE )

ALTER DEPARTMENT TABLE :: ( NAVATHE BOOK DATABASE )








EMPLOYEE TABLE CREATION:: ( NAVATHE BOOK DATABASE )













EMPLOYEE TABLE CREATION:: ( NAVATHE BOOK DATABASE )








DEPARTMENT TABLE CREATION :: ( NAVATHE BOOK DATABASE )

DEPARTMENT TABLE CREATION :: ( NAVATHE BOOK DATABASE )







COMPANY DATABASE NAVATHE BOOK


COMPANY DATABASE NAVATHE BOOK




 CREATE TABLE :

1.  DEPARTMENT -- CLICK HERE   ALTER TABLE DEPARTMENT

2.  EMPLOYEE -- CLICK HERE
 
3.  DEPT_LOCATIONS -- CLICK HERE

4.  PROJECT --  CLICK HERE

5. WORKS_ON --  CLICK HERE

6. DEPENDENT --  CLICK HERE
                


Thursday, June 4, 2020

RED BLACK TREE INSERTION STEP BY STEP EXPLANATION


RED BLACK TREE INSERTION STEP BY STEP EXPLANATION



DYSTRAS ALGORITHM OR DIJKSTRAS ALGORITHM STEP BY STEP EXPLANATION

DYSTRAS ALGORITHM OR DIJKSTRAS ALGORITHM STEP BY STEP EXPLANATION


PRIMS ALGORITHM EXPLANATION STEP BY STEP




KRUSKAL ALGORITHM EXPLANATION STEP BY STEP

KRUSKAL ALGORITHM EXPLANATION STEP BY STEP


HEAP SORT ALGORITHM STEP BY STEP EXPLANATION


HEAP SORT ALGORITHM STEP BY STEP EXPLANATION


QUICK SORT algorithm implementation example step by step


QUICK SORT algorithm implementation example step by step


selection sort example step by step


selection sort example step by step explanation



🎯 What is Selection Sort?

Selection Sort is a simple sorting algorithm that repeatedly selects the smallest element from the unsorted part of the array and places it at the beginning.


📌 Definition

Selection Sort is a comparison-based sorting algorithm in which the smallest element is selected from the unsorted portion and swapped with the first unsorted element.


🧠 How Selection Sort Works

Steps:

  1. Find the smallest element in the array
  2. Swap it with the first element
  3. Move to next position
  4. Repeat for remaining unsorted part
  5. Continue until array is sorted

📊 Example

Unsorted Array:

A = [64, 25, 12, 22, 11]

🔁 Pass 1

Smallest = 11

Swap with first element:

[11, 25, 12, 22, 64]

🔁 Pass 2

Remaining array: [25, 12, 22, 64]

Smallest = 12

[11, 12, 25, 22, 64]

🔁 Pass 3

Remaining array: [25, 22, 64]

Smallest = 22

[11, 12, 22, 25, 64]

🔁 Pass 4

Remaining array: [25, 64]

Already in order

[11, 12, 22, 25, 64]

📌 Final Sorted Array

[11, 12, 22, 25, 64]

💻 Algorithm (Pseudocode)

SelectionSort(A, n)

1. for i = 0 to n-1
2. minIndex = i
3. for j = i+1 to n-1
4. if A[j] < A[minIndex]
5. minIndex = j
6. swap(A[i], A[minIndex])

🐍 Python Program for Selection Sort

def selection_sort(arr):
n = len(arr)

for i in range(n):
min_index = i

for j in range(i + 1, n):
if arr[j] < arr[min_index]:
min_index = j

arr[i], arr[min_index] = arr[min_index], arr[i]

return arr

# Example
arr = [64, 25, 12, 22, 11]

result = selection_sort(arr)

print("Sorted Array:", result)

Output:

Sorted Array: [11, 12, 22, 25, 64]

⚡ Time Complexity

CaseComplexity
Best CaseO(n²)
Worst CaseO(n²)
Average CaseO(n²)

📊 Space Complexity

  • O(1) (in-place sorting)

🆚 Selection Sort vs Bubble Sort

FeatureSelection SortBubble Sort
MethodSelect minimumSwap adjacent
SwapsFewer swapsMany swaps
SpeedSlightly fasterSlower
Stability❌ Not stable✅ Stable
ComplexityO(n²)O(n²)

📌 Advantages

  • Simple to understand
  • Performs fewer swaps than bubble sort
  • Works in-place (no extra memory)

❌ Disadvantages

  • Very slow for large data sets
  • Always O(n²) time complexity
  • Not stable sorting algorithm

🧠 Real Life Example

  • Selecting smallest student roll number and placing first 🧑‍🎓
  • Sorting cards by repeatedly picking smallest card 🃏

📌 Summary

  • Selection sort selects the smallest element repeatedly
  • Places it at the correct position
  • Performs O(n²) comparisons
  • Efficient for small datasets only

❓ Important Questions

Short Questions

  1. What is selection sort?
  2. What is the main idea of selection sort?
  3. What is time complexity of selection sort?
  4. Is selection sort stable?
  5. How many swaps are used in selection sort?

Long Questions

  1. Explain selection sort with example.
  2. Write algorithm of selection sort.
  3. Write Python program for selection sort.
  4. Compare selection and bubble sort.
  5. Explain advantages and disadvantages of selection sort. 

RECURSIVE MERGE SORT example and recursion tree

RECURSIVE MERGE SORT example and recursion tree


BFS algorithm step by step

BFS algorithm step by step explanation


DFS algorithm step by step example

DFS algorithm step by step example


Tuesday, June 2, 2020

SZE INSTRUCTION

SZE INSTRUCTION

SZA INSTRUCTION

SZA INSTRUCTION

SNA INSTRUCTION

SNA INSTRUCTION

SPA INSTRUCTION


SPA INSTRUCTION



ISZ INSTRUCTION

  ISZ INSTRUCTION

MORRIS MANO ASSEMBLY LEVEL LANGUAGE

INSERTION SORT ALGORITHM STEP BY STEP

INSERTION SORT ALGORITHM STEP BY STEP

🎯 What is Insertion Sort?

Insertion Sort is a simple sorting algorithm that builds the final sorted array one element at a time by inserting each element into its correct position in the already sorted part.


📌 Definition

Insertion Sort is a comparison-based algorithm in which each element is picked and inserted into its correct position in a sorted subarray.


🧠 How Insertion Sort Works

Steps:

  1. Start from the second element
  2. Compare it with elements before it
  3. Shift larger elements one position right
  4. Insert the element in correct position
  5. Repeat for all elements

📊 Example

Unsorted Array:

A = [12, 11, 13, 5, 6]

🔁 Step-by-step


Pass 1 (Insert 11)

Compare 11 with 12 → shift 12

[11, 12, 13, 5, 6]

Pass 2 (Insert 13)

Already in correct position

[11, 12, 13, 5, 6]

Pass 3 (Insert 5)

Shift 13, 12, 11

[5, 11, 12, 13, 6]

Pass 4 (Insert 6)

Shift 13, 12, 11

[5, 6, 11, 12, 13]

📌 Final Sorted Array

[5, 6, 11, 12, 13]

💻 Algorithm (Pseudocode)

InsertionSort(A, n)

1. for i = 1 to n-1
2. key = A[i]
3. j = i - 1
4. while j >= 0 AND A[j] > key
5. A[j + 1] = A[j]
6. j = j - 1
7. A[j + 1] = key

🐍 Python Program for Insertion Sort

def insertion_sort(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i - 1

while j >= 0 and arr[j] > key:
arr[j + 1] = arr[j]
j -= 1

arr[j + 1] = key

return arr

# Example
arr = [12, 11, 13, 5, 6]

result = insertion_sort(arr)

print("Sorted Array:", result)

Output:

Sorted Array: [5, 6, 11, 12, 13]

⚡ Time Complexity

CaseComplexity
Best CaseO(n)
Worst CaseO(n²)
Average CaseO(n²)

📊 Space Complexity

  • O(1) (in-place sorting)

🆚 Insertion Sort vs Other Sorting

FeatureInsertion SortBubble SortSelection Sort
MethodInsert element in correct positionSwap adjacent elementsSelect minimum element
Best CaseO(n)O(n)O(n²)
EfficiencyGood for small/nearly sorted dataPoorPoor
Stability✅ Stable✅ Stable❌ Not stable

📌 Advantages

  • Simple to implement
  • Efficient for small or nearly sorted data
  • Stable sorting algorithm
  • Works in-place (no extra memory)

❌ Disadvantages

  • Slow for large datasets
  • O(n²) complexity in worst case

🧠 Real Life Example

  • Arranging playing cards in hand 🃏
  • Inserting a new book in a sorted bookshelf 📚

📌 Summary

  • Insertion Sort builds a sorted list step by step
  • Each element is inserted in correct position
  • Best performance when data is already nearly sorted
  • Simple but not suitable for large datasets

❓ Important Questions

Short Questions

  1. What is insertion sort?
  2. What is key element in insertion sort?
  3. What is best case complexity?
  4. Is insertion sort stable?
  5. Give one real-life example.

Long Questions

  1. Explain insertion sort with example.
  2. Write algorithm of insertion sort.
  3. Write Python program for insertion sort.
  4. Compare insertion sort with bubble and selection sort.
  5. Explain advantages and disadvantages of insertion sort.

RADIX SORT ALGORITHM STEP BY STEP

RADIX SORT ALGORITHM STEP BY STEP