Skip to content

IsoDevMate/dsa-recap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

In binary trees they allow search in (0 l(og n)) eg sorted arrays get the eg techniques like divide and conquer .... thus this leads to a faster seraching since they allow for seraching T;hus arrays are faster thn liknked lists ..... In arrays in inserting or deleting is (0(n) ) thi s t in the middle its really slow...

linked lists -

  1. Bad at Random Access Problem: No direct access to elements.

Why it's bad: You can’t do list[10] in constant time like arrays.

Time complexity: O(n) to access the nth element.

Example: Scrolling to the 1,000th comment in a linked list takes 1,000 steps.

  1. Bad Cache Performance Problem: Nodes are scattered in memory.

Why it's bad: CPUs love contiguous memory (like arrays), which helps with prefetching and speed.

Result: Linked lists are slower due to frequent cache misses.

  1. High Memory Overhead Problem: Each node needs extra memory for a pointer/reference.

Why it's bad: A linked list uses more memory than an array for the same number of elements.

Example: A list of 1 million integers = 1 million pointers = extra 8MB+ memory (on 64-bit).

  1. Slower Search Problem: No way to "jump" to the correct place.

Why it's bad: You must traverse the list sequentially — O(n) for searching.

Contrast: Arrays allow binary search if sorted (O(log n)).

  1. Inefficient for Some Insert/Delete Cases Problem: You must find the node before the target to delete.

Why it's bad: Searching for that node is O(n) unless you already have a reference to it.

Also: Doubly linked lists have better delete flexibility but even more memory usage.

About

DSA challenges i often work on...

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published