📙
Python Programming
  • Python Programming
  • Installation and Setup
  • Part 1: Basics
    • Variables
      • Primitive Data Types
      • Secondary Data Types
    • Control Flow and Loop
    • Functions
    • Error Handling
    • Decorators
    • Constructor
    • Built-in Functions and Modules
    • Pythonic Code
    • Miscellaneous Functionalities
    • Understanding Checkpoint I
    • Python Problem Practice I
      • Solutions
  • Part 2: Level Up
    • Real Life Application I
    • Real Life Application II
    • OOP Concepts
    • Creating Library
    • Real Life Application III
  • Processing Related
    • Parallel Processing
    • Oreilly - High Performance Python
    • Memory Management
      • Memory Leak
      • String
      • Array
      • Dictionary
    • Ubuntu CPU and RAM
    • Time and Space Complexity
  • Data Structure
    • Data Structure Overview
    • Array
    • Stack
    • Queue
    • LinkedList
    • Hash-table and Hash-map
    • Recursion
    • Binary Tree
    • Heap Data Structure
    • Graphs
      • Python Graph Visualisation
    • Dynamic Programming
    • Problem Solving Techniques
    • Additional topics
Powered by GitBook
On this page
  1. Data Structure

Additional topics

for self reference, to read and find the applications

PreviousProblem Solving Techniques

Last updated 4 years ago

Was this helpful?

CtrlK
  • Arrays
  • ArrayList:
  • Linked List:
  • Doubly-Linked List:
  • Stack:
  • Queue/Deque/Circular Queue:
  • Binary Search Tree:
  • Red-Black Tree:
  • Heap/PriorityQueue (min/max):
  • HashMap/Hashtable/HashSet:

Was this helpful?

Flask: https://faun.pub/deploy-flask-app-with-nginx-using-gunicorn-7fda4f50066a

CGI in python: https://www.edureka.co/blog/python-cgi/

best python practices: https://realpython.com/tutorials/best-practices/

bots: https://realpython.com/how-to-make-a-discord-bot-python/

Arrays

  • Set, Check element at a particular index: O(1)

  • Searching: O(n) if array is unsorted and O(log n) if array is sorted and something like a binary search is used,

  • As pointed out by Aivean, there is no Delete operation available on Arrays. We can symbolically delete an element by setting it to some specific value, e.g. -1, 0, etc. depending on our requirements

  • Similarly, Insert for arrays is basically Set as mentioned in the beginning

ArrayList:

  • Add: Amortized O(1)

  • Remove: O(n)

  • Contains: O(n)

  • Size: O(1)

Linked List:

  • Inserting: O(1), if done at the head, O(n) if anywhere else since we have to reach that position by traveseing the linkedlist linearly.

  • Deleting: O(1), if done at the head, O(n) if anywhere else since we have to reach that position by traveseing the linkedlist linearly.

  • Searching: O(n)

Doubly-Linked List:

  • Inserting: O(1), if done at the head or tail, O(n) if anywhere else since we have to reach that position by traveseing the linkedlist linearly.

  • Deleting: O(1), if done at the head or tail, O(n) if anywhere else since we have to reach that position by traveseing the linkedlist linearly.

  • Searching: O(n)

Stack:

  • Push: O(1)

  • Pop: O(1)

  • Top: O(1)

  • Search (Something like lookup, as a special operation): O(n) (I guess so)

Queue/Deque/Circular Queue:

  • Insert: O(1)

  • Remove: O(1)

  • Size: O(1)

Binary Search Tree:

  • Insert, delete and search: Average case: O(log n), Worst Case: O(n)

Red-Black Tree:

  • Insert, delete and search: Average case: O(log n), Worst Case: O(log n)

Heap/PriorityQueue (min/max):

  • Find Min/Find Max: O(1)

  • Insert: O(log n)

  • Delete Min/Delete Max: O(log n)

  • Extract Min/Extract Max: O(log n)

  • Lookup, Delete (if at all provided): O(n), we will have to scan all the elements as they are not ordered like BST

HashMap/Hashtable/HashSet:

  • Insert/Delete: O(1) amortized

  • Re-size/hash: O(n)

  • Contains: O(1)