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

DataStructures Notes

This document provides a concise overview of data structures, categorizing them into linear (e.g., arrays, linked lists, stacks, queues) and non-linear (e.g., trees, graphs) types. It outlines key characteristics, operations, and use cases for each structure, as well as searching and sorting algorithms with their time complexities. Additionally, it highlights common exam points related to these data structures for competitive exam preparation.
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)
2 views2 pages

DataStructures Notes

This document provides a concise overview of data structures, categorizing them into linear (e.g., arrays, linked lists, stacks, queues) and non-linear (e.g., trees, graphs) types. It outlines key characteristics, operations, and use cases for each structure, as well as searching and sorting algorithms with their time complexities. Additionally, it highlights common exam points related to these data structures for competitive exam preparation.
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

Data Structures — Quick Notes

Computer Knowledge Section — Competitive Exam Preparation

What is a Data Structure?


A way of organizing and storing data so it can be accessed and used efficiently.

Types: Linear vs Non-Linear


• Linear: elements arranged sequentially — Array, Linked List, Stack, Queue
• Non-Linear: elements arranged hierarchically / interconnected — Tree, Graph

Key Structures
Array
• Fixed-size, contiguous memory, same data type
• Access by index — O(1) access time
• Insertion/deletion costly (shifting elements)

Linked List
• Nodes connected via pointers (data + address of next node)
• Types: Singly, Doubly, Circular
• Easy insertion/deletion, no random access (must traverse)

Stack
• LIFO (Last In First Out)
• Operations: push (insert), pop (remove)
• Uses: function calls, undo operations, expression evaluation, backtracking

Queue
• FIFO (First In First Out)
• Operations: enqueue (insert), dequeue (remove)
• Types: Simple, Circular, Priority Queue, Deque
• Uses: scheduling, buffering

Tree
• Hierarchical, node-based, starts from a root
• Binary Tree: each node has max 2 children
• Binary Search Tree (BST): left child < root < right child
• Uses: hierarchical data, searching (faster than linked list)

Graph
• Set of vertices (nodes) connected by edges
• Types: Directed/Undirected, Weighted/Unweighted
• Uses: networks, maps, social connections
Searching Algorithms
• Linear Search: checks each element — O(n)
• Binary Search: works on sorted data, divide and conquer — O(log n)

Sorting Algorithms (Commonly Asked)


Algorithm Best Case Worst Case

Bubble Sort O(n) O(n²)

Selection Sort O(n²) O(n²)

Insertion Sort O(n) O(n²)

Merge Sort O(n log n) O(n log n)

Quick Sort O(n log n) O(n²)

Commonly Asked Exam Points


• Stack follows LIFO, Queue follows FIFO — frequently confused in exams
• Array has fixed size; Linked List is dynamic
• Tree with n nodes has n − 1 edges
• Time complexity of accessing an array element: O(1)

You might also like