CSE3144 ยท Advanced Data Structures ยท Julโ€“Nov Semester 2026 ยท B.Tech CSE, Sem V

Advanced Data Structures

Lectures 1โ€“2 โ€” Course Orientation and the Foundations of Advanced Data Structures.

Dr. Manu ShrivastavaCourse Instructor ยท Consultation Fri 2โ€“5 PM, LHC 308F
Department of Computer Science & Engineering โ€” Manipal University Jaipur
01

Lecture 1

Introduction and Course Hand-out Briefing

Session outcome: understand the course objectives, applications, and assessment methodology.
L1 ยท 01 โ€” Why this course exists

From "Data Structures" to "Advanced Data Structures"

You already know arrays, linked lists, stacks, queues, and basic binary search trees from CS 1301. Those structures assume data that is small, uniform, and lives comfortably in memory. This course is about what happens when any one of those assumptions fails โ€” and which structure you reach for when it does.

Prerequisite

Programming in C

CS 1101 โ€” syntax, memory, pointers.

Prerequisite

Data Structures

CS 1301 โ€” arrays, lists, basic trees, basic hashing.

You are here

Advanced Data Structures

CSE3144 โ€” balancing, amortization, disk-awareness, geometry, probability.

CSE3144 โ€” Lecture 1
L1 ยท 02 โ€” Course outcomes

What you should be able to do by the end

COStatementBloom's levelTarget
CSE3144.1Illustrate amortized analysis and compare data-structure efficiency in dynamic environments.Understandโ‰ฅ 80%
CSE3144.2Develop and implement external sorting for large-scale data.Applyโ‰ฅ 80%
CSE3144.3Construct tries, suffix trees, bloom filters, and persistent structures for text/search/DB problems.Apply70โ€“80%
CSE3144.4Utilize advanced structures to solve complex computational problems across domains.Apply70โ€“80%
CSE3144.5Analyse and apply advanced data structures to real-world problems.Analyse70โ€“80%
CSE3144 โ€” Lecture 1
L1 ยท 03 โ€” How you're evaluated

Assessment plan โ€” 100 marks total

Mid-Term ยท 30
CWS ยท 30
End-Term ยท 40
Mid-Term Examination โ€” 30 Class Work Sessional โ€” 30 End-Term Examination โ€” 40
CWS breakdown (30 marks, mandatory)
  • 3 Quizzes, best 2 counted โ€” 20 marks
  • Assignment โ€” 5 marks
  • Attendance โ€” 5 marks
Attendance rubric
90โ€“100%5 marks
85โ€“90%4 marks
80โ€“84%3 marks
75โ€“80%2 marks
< 75%0 marks
CSE3144 โ€” Lecture 1
L1 ยท 04 โ€” The syllabus at a glance

Five units, thirty-six lectures

I ยท Foundations of Advanced Data Structures

Lec 2โ€“6

Amortized analysis, external sorting, tournament trees & buffering, Huffman trees.

II ยท Advanced Tree Structures

Lec 7โ€“15

AVL, Red-Black, Splay Trees, B/B+/B*-Trees, Segment & Interval Trees, Tries, Suffix Trees.

III ยท Advanced Heaps & Priority Queues

Lec 16โ€“21

Binary, Binomial, and Fibonacci Heaps, Pairing Heaps, Double-Ended Priority Queues.

IV ยท Spatial Data Structures

Lec 22โ€“27

k-d Trees, Quad/Oct Trees, BSP Trees, R-Trees and spatial indexing.

V ยท Specialized Data Structures

Lec 28โ€“32

Bloom Filters, Priority Search Trees, Persistent Data Structures, Disjoint Set Union.

Integration & Revision

Lec 33โ€“36

Cross-topic problem solving, case studies, end-term preparation.

CSE3144 โ€” Lecture 1
L1 ยท 05 โ€” Texts & logistics

Reference shelf and where to find me

Textbooks

Mark Allen Weiss โ€” Data Structures and Algorithm Analysis in C++, 2nd ed., Pearson, 2004.

Cormen, Leiserson, Rivest, Stein โ€” Introduction to Algorithms, 3rd ed., MIT Press, 2010.

Reference

Goodrich & Tamassia โ€” Algorithm Design, John Wiley, 2002.

Consultation

Dr. Manu Shrivastava โ€” LHC 308F โ€” Friday, 2:00โ€“5:00 PM

CSE3144 โ€” Lecture 1
L1 ยท 06 โ€” Learning beyond the classroom

What you're expected to do outside class

ActivityDifficultyHours
Weekly coding problems โ€” LeetCode, HackerRank, CodeChefMedium10 h
Group discussion / peer learning sessionsLow6 h
Curated video lectures โ€” NPTEL, MIT OCW, YouTube ADS playlistsMedium6 h
Summary notes / mind maps for core conceptsMedium4 h
Internal / external ADS quizzesHigh2 h
ADS workshops / seminarsMedium2 h

Row three โ€” curated video lectures โ€” is exactly where today's assignment lives. A mapped reading list of NPTEL, MIT OCW, Coursera and Udemy courses is at the end of this deck.

CSE3144 โ€” Lecture 1
02

Lecture 2

Foundations of Advanced Data Structures

Session outcome: explain the need and applications of advanced data structures.
L2 ยท 01 โ€” Recap: the CS 1301 toolkit

What "basic" gets you, and its hidden assumptions

Arrays, linked lists, stacks, queues, and a plain binary search tree solve most problems taught in an intro course. But every one of them quietly assumes four things โ€” the next four slides take each assumption in turn and show exactly where it breaks.

CSE3144 โ€” Lecture 2
L2 ยท 02 โ€” Recap: the CS 1301 toolkit

Assumption 1: data fits in memory

Arrays and pointer-based lists assume O(1) random access to any position โ€” true for RAM, false the moment data lives on disk and doesn't fit in RAM. No basic structure reasons about pages, blocks, or transfer costs; it just assumes every access costs the same.

12345678
external merge sort โ€” each box is a POSITION label; left-to-right is the order it's touched, not a data value
52718364
quicksort โ€” same 8 positions, touched in this jumbled order instead
Why quicksort jumps

Partitioning uses two pointers, one starting at each end of the range, moving toward each other and swapping whenever a pair is on the wrong side of the pivot. An element violating the pivot condition could be anywhere in the remaining range โ€” so the algorithm has no choice but to keep reaching toward both extremes at once until they meet in the middle. Both algorithms must read values to compare them; the difference is that a swap decision here can require two positions that are still very far apart.

Why merge sort marches

A merge only ever needs the current front element of each already-sorted run โ€” never an arbitrary one, because each run's own sorted order guarantees the next-needed element is always the very next one physically. So only a small, fixed window per run needs to be "hot" at once, and that window only ever slides forward. It never needs to reach far ahead or jump back.

Case โ€” sorting a 100 GB log file on 8 GB RAM

Quicksort's pivot-relative comparisons force it to hold two widely separated, converging regions of the file live at once, constantly re-fetching between them. One disk seek โ‰ˆ 10 ms; one RAM access โ‰ˆ 100 ns โ€” a 100,000ร— gap. The algorithm that "won" in class by comparison count thrashes for days on disk-resident data; an external merge sort that reads and writes in sequential runs finishes in hours.

This is also why databases index with B-Trees (branching factor of hundreds, one node = one disk page) rather than plain binary trees โ€” the same locality principle, applied to search instead of sorting. External sorting gets its own full treatment in Lecture 4; B-Trees in Lecture 11.

CSE3144 โ€” Lecture 2
L2 ยท 03 โ€” Recap: the CS 1301 toolkit

Assumption 2: keys arrive in a "nice" order

A binary search tree is only O(log n) to search if it stays roughly balanced โ€” but nothing in the structure itself enforces that. Insert always follows the same rule: compare the new key against the current node, go left if smaller, go right if larger, and repeat until you fall off the tree into an empty spot. The shape that produces is decided entirely by the order keys arrive in, not by the structure.

Same 7 keys, inserted as 4, 2, 6, 1, 3, 5, 7
4
2
1
3
6
5
7
balanced โ€” height 2

Each new key lands roughly in the middle of the range still available on its side, so the tree fills out in both directions at close to the same rate.

Same 7 keys, inserted as 1, 2, 3, 4, 5, 6, 7
1
2
3
4
5
6
7
skewed โ€” height 6

Every new key is larger than every key already in the tree, so the comparison rule sends it right, every single time, at every level. The "tree" is really a linked list wearing a tree's clothing โ€” search degrades from O(log n) to O(n).

Case โ€” inserting employee IDs 1001, 1002, 1003, โ€ฆ

This isn't a rare, adversarial edge case โ€” sorted or reverse-sorted keys are the most common real-world pattern: auto-increment IDs, timestamps, roll numbers all arrive in increasing order by construction. 1,000,000 sorted inserts → height 1,000,000, vs. ~20 for a balanced tree. A search that should take 20 comparisons takes a million instead โ€” from data doing nothing more exotic than arriving in order.

AVL and Red-Black trees (Lectures 7โ€“9) exist precisely to survive this input โ€” they add a rule that actively re-shapes the tree during insertion, so the shape can never degrade this way no matter what order keys arrive in.

CSE3144 โ€” Lecture 2
L2 ยท 04 โ€” Recap: the CS 1301 toolkit

Assumption 3: data is one-dimensional

Every basic structure orders its elements by a single key โ€” one number line. Sorting or indexing by one coordinate tells you nothing reliable about any other coordinate the data might have.

What "sort by latitude" actually buys you

Restaurants sorted in an array by latitude alone DOES let you binary-search for a latitude band quickly โ€” that part of a 1-D index still works fine. But "within 2 km of me" is a constraint on both latitude and longitude together โ€” a circle drawn on a 2-D plane, not a slice of one number line.

Why the band still has to be scanned fully

Inside that qualifying latitude band, restaurants can have wildly different longitudes โ€” some right next door, some clear across the city at the same latitude. The latitude ordering gives no way to prune on longitude at all, so every entry in the band must be individually checked. If a city is laid out east-west, that band can contain most of the data.

actual match (within 2 km) same latitude, wrong longitude different latitude โ€” correctly excluded
Case โ€” "restaurants within 2 km of me"

Each restaurant is a point (latitude, longitude). A 1-D index answers a 2-D rectangle query in O(n) in the worst case โ€” no amount of sorting by one coordinate rescues the other. The same wall appears in game collision detection (is anything near this position?) and k-nearest-neighbour queries in ML (which training points are close to this one?).

Spatial trees โ€” k-d trees, quad trees, R-Trees (Unit IV, Lectures 22โ€“27) โ€” solve this by partitioning space itself, not a single key line, so a query can prune large regions of the plane at once instead of scanning a band that still spans the whole dataset.

CSE3144 โ€” Lecture 2
L2 ยท 05 โ€” Recap: the CS 1301 toolkit

Assumption 4: membership must be exact

Hash tables and BSTs answer "is X in the set?" with certainty โ€” but only by storing every element, paying memory proportional to how many elements you have. What if the set has millions of entries and that certainty is more than you can afford to carry around?

Setup โ€” insert two blacklisted URLs

Start with 12 bits, all 0 โ€” nothing stored yet, not even one URL's text. Each URL is run through 2 different hash functions, and each hash function flips exactly one bit to 1. Two URLs, 2 hash functions each, so up to 4 bits get set.

0100 1001 0010
bits 2, 5, 8, 11 are now 1 (1-indexed) โ€” every other bit is still 0, and stays 0 unless something hashes there
Query X โ€” a definite "no"
0100 1001 0010

X's own 2 hash functions point at positions 3 and 8. Position 3 reads 0 → stop immediately: X is definitely not on the blacklist. This is a hard guarantee, not a guess โ€” bits are only ever set to 1, never cleared back to 0, so a 0 is proof nothing has ever hashed there. It doesn't even matter that position 8 happens to be 1; one 0 is enough.

Query Y โ€” only a "maybe"
0100 1001 0010

Y's hash functions point at positions 2 and 11. Both read 1 โ€” but that does not mean Y was ever inserted. Those bits are 1 because the two URLs we did insert happened to land there. There is no way to tell "Y was really inserted" apart from "Y's hashes coincidentally match existing 1-bits" just by looking at the array. So the only honest answer is possibly present.

Case โ€” browser checking URLs against a malware blacklist

The blacklist has millions of URLs, and this memory must be shipped to and duplicated on every single user's device โ€” not stored once on a server. A Bloom filter stores no elements at all, just a bit array. ~1.2 MB for 1M entries at a 1% false-positive rate, and the rare "possibly" is confirmed with one server round-trip.

Bloom filters get their full treatment โ€” choosing k and m, the false-positive-probability formula, and why deletion is hard โ€” in Lecture 28.

CSE3144 โ€” Lecture 2
L2 ยท 06 โ€” Where those assumptions break

Four failures, four responses

Sorted / adversarial insertionsBST degenerates into a linked list โ€” O(n) search
โŸถ
Self-balancing treesAVL, Red-Black, Splay โ€” Unit II
Data larger than RAMNaive in-memory sort/search collapses under disk I/O
โŸถ
Disk-aware structures & algorithmsB-Trees, external sorting, tournament trees โ€” Unit I & II
Multi-dimensional data"Points inside this rectangle?" has no 1-D ordering
โŸถ
Spatial treesk-d, Quad/Oct, BSP, R-Trees โ€” Unit IV
Billions of items to testStoring every element for exact lookup is too costly
โŸถ
Probabilistic & specialized structuresBloom Filters, DSU, Persistent DS โ€” Unit V
CSE3144 โ€” Lecture 2
L2 ยท 07 โ€” Who actually uses these

From lecture slide to production system

StructureReal system
B-Trees / B+-TreesFilesystem indexes (NTFS, ext4); database indexes (PostgreSQL, InnoDB)
Tries / Suffix TreesAutocomplete, spell-check, genome pattern search, search-engine indexing
Fibonacci / Binomial HeapsDijkstra's & Prim's algorithms at scale โ€” network routing
k-d Trees / R-TreesMaps & GIS, nearest-neighbour search, k-NN in machine learning
Bloom FiltersBrowser safe-browsing lists, key-value stores (Cassandra), spell-checkers
Disjoint Set UnionKruskal's MST, image segmentation, network connectivity
Persistent Data StructuresVersion control (Git), functional languages, time-travel debugging
CSE3144 โ€” Lecture 2
L2 ยท 08 โ€” What "advanced" means, precisely

Three flavours of guarantee

"Advanced" in this course's title does not mean "a more complicated version of what you already know." It means each structure makes a deliberate choice about what kind of promise to offer โ€” matched to the workload it targets, not chosen for its own sake. There are exactly three flavours that promise can take.

Worst-case

Every single operation is bounded

No "usually fast, occasionally slow" escape hatch โ€” the bound holds no matter how unlucky the input or the timing is. AVL and Red-Black trees are the standing example: O(log n) search, insert, and delete, always, regardless of what order keys arrive in. Pick this flavour when even one catastrophically slow operation is unacceptable โ€” real-time systems, latency-sensitive services.

Amortized

Rare expensive ops, cheap on average

Individual operations can occasionally be expensive, but averaged over a long sequence of operations, the cost per operation stays cheap. A dynamic array (Python's list, C++'s vector) is the simplest example: doubling its backing storage costs O(n) for that one operation, but it happens so rarely that spread across n insertions it washes out to O(1) each. This trusts the average, not every individual instance โ€” a fundamentally different kind of claim than worst-case.

Probabilistic

Correct with high probability

A small, controlled chance of being wrong is accepted, in exchange for something valuable in return โ€” usually space or speed. Bloom filters are the example from earlier this lecture: a false positive is possible and accepted, in exchange for storing zero actual elements. Even a plain hash table's famous O(1) average lookup is this flavour in disguise โ€” it only holds if the hash function spreads keys roughly evenly; adversarial input can still force O(n).

FlavourWhere it comes fromWhere you'll see it this semester
Worst-caseA structural rule that actively re-shapes the structure so a bad case can never arise โ€” directly closes the sorted-insertion gap from L2ยท03.AVL, Red-Black, B-Trees โ€” Unit II
AmortizedA cost that looks expensive in isolation but is provably rare enough to average out โ€” the how to prove it is next lecture.Dynamic arrays, Fibonacci/Binomial Heaps โ€” Unit I & III
ProbabilisticCertainty deliberately traded away for space or speed โ€” the exact trade unpacked for Bloom filters in L2ยท05.Bloom Filters, skip lists, hashing โ€” Unit V

Almost every structure in this course is "advanced" because it deliberately chooses which of these three guarantees to offer. As new structures appear in later lectures, the useful habit this slide is trying to install is to ask, before anything else: which of these three promises is this one making, and why does its workload need exactly that one?

CSE3144 โ€” Lecture 2
L2 ยท 09 โ€” Recap & what's next

Three takeaways from today

Next lecture

Amortized Analysis Techniques

Aggregate method, accounting method, and the potential method โ€” proving that "occasionally expensive" can still mean "cheap on average."

CSE3144 โ€” Lecture 2
CWS Component ยท Assignment โ€” 5 marks

Curated courses, mapped to this syllabus

Pick the course below closest to the unit you find hardest, complete the modules that overlap with our lecture plan, and submit a one-page note connecting one concept from the MOOC to the terminology used in this course.

CourseProviderMaps toLink
Introduction to Data Structures and Algorithms
Prof. Naveen Garg, IIT Delhi
NPTEL Unit I (dictionaries), Unit II (2-4/Red-Black trees, tries), Unit III (binary heaps) nptel.ac.in/courses/106102064
Design and Analysis of Algorithms (6.046J)
Prof. Erik Demaine, Srinivas Devadas & Nancy Lynch, MIT
MIT OpenCourseWare Unit I โ€” amortized analysis (aggregate, accounting, and potential methods), taught with the same multipop-stack and binary-counter examples used in Lecture 3 ocw.mit.edu/6-046j-design-and-analysis-of-algorithms-spring-2015
Computational Geometry
Prof. Pankaj Agarwal, IIT Delhi
NPTEL Unit IV โ€” range searching, quadtrees, k-d trees, clustering YouTube playlist โ€” Computational Geometry
6.851 Advanced Data Structures
Prof. Erik Demaine, MIT
MIT OpenCourseWare Unit V (persistent data structures), enrichment for Unit II (advanced trees) ocw.mit.edu/6-851-advanced-data-structures-spring-2012
Data Structures
UC San Diego & HSE โ€” Data Structures and Algorithms Specialization
Coursera Unit II (AVL/splay trees), Unit III (priority queues), Unit V (disjoint sets) coursera.org/learn/data-structures
Advanced Data Structures โ€” Part I: Tree ADT Udemy Unit II โ€” hands-on coding companion: BST, Heap, AVL, Red-Black, B-Tree udemy.com/course/advanced-data-structures-tree-adt

Note: even with the MIT 6.046J entry above covering amortized analysis, no single MOOC covers Unit I's tournament trees / external sorting or Unit V's Bloom filters and priority search trees in full depth โ€” those stay primarily lecture- and textbook-driven (Weiss, CLRS).

Assignment Brief

Questions?

Dr. Manu Shrivastava โ€” LHC 308F โ€” Friday 2:00โ€“5:00 PM

Next: Lecture 3 โ€” Amortized Analysis Techniques.