Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views2 pages

NEC DS CheatSheet

The document is a cheatsheet covering essential concepts in data structures, sorting, searching, and graphs. It includes definitions and operations for various data structures such as arrays, linked lists, trees, and graphs, as well as sorting algorithms and their complexities. Additionally, it discusses hashing techniques and algorithms for minimum spanning trees and shortest paths.

Uploaded by

birajthapa983
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

NEC DS CheatSheet

The document is a cheatsheet covering essential concepts in data structures, sorting, searching, and graphs. It includes definitions and operations for various data structures such as arrays, linked lists, trees, and graphs, as well as sorting algorithms and their complexities. Additionally, it discusses hashing techniques and algorithms for minimum spanning trees and shortest paths.

Uploaded by

birajthapa983
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

NEC Cheatsheet - Data Structures, Sorting, Searching & Graphs

DATA STRUCTURE BASICS


- Data Types: int, float, char, pointer, etc.
- Data Structures: Array, Linked List, Stack, Queue, Tree, Graph
- ADT: Abstract representation of data and operations
- Big-O: Worst-case | Big-Omega: Best-case | Big-Theta: Average-case

LINEAR STRUCTURES
- Array: Fixed size, direct access, O(1) lookup
- Stack: LIFO, push/pop - used in recursion, expression evaluation
- Queue: FIFO, enqueue/dequeue - scheduling, buffers
- Infix to Postfix: Use stack to rearrange
- Postfix Evaluation: Use stack to evaluate expression

LINKED LISTS
- Singly: One-way links | Doubly: Two-way | Circular: Loop back
- Operations: Insert (head/tail/mid), Delete (head/tail/mid)
- Dynamic memory: malloc/free (C), new/delete (C++)

TREES
- Binary Tree: Max 2 children | BST: Left<root<Right
- Traversals: In-order (LNR), Pre-order (NLR), Post-order (LRN)
- Height = longest path to leaf | Depth = root to node
- AVL Tree: Balanced BST using rotations after insert/delete

SORTING ALGORITHMS
- Selection Sort: O(n^2) | Bubble: O(n^2) | Insertion: O(n^2)
- Merge Sort: O(n log n) | Quick Sort: Avg O(n log n), Worst O(n^2)
- Heap Sort: Uses binary heap, O(n log n)
- Radix Sort: Non-comparison, O(kn) | Shell Sort: Improved insertion

HASHING
- Hash Function: Converts key to index
- Collision Handling: Chaining, Linear Probing, Double Hashing
- Load Factor: n/table size - keep < 0.7
- Perfect Hash: No collisions (ideal)

GRAPHS
- Representation: Adj. Matrix (O(V^2)), Adj. List (O(V+E))
- DFS: Stack or recursion | BFS: Queue
- Transitive Closure: Warshall's Algorithm (O(V^3))
- Topological Sort: DAG only, DFS/BFS based

MST & SHORTEST PATH


- Prim's: Greedy, grows from a node | Kruskal: Greedy, edge-based
- Dijkstra: No negative weights | Bellman-Ford: Handles negatives
- Spanning Tree: Connects all nodes, min total edge cost
- Shortest Path Tree: Min cost path from source to all

You might also like