Data Structures - Abstract Data Types

Beschreibung

This mind map entails all the Abstract Data Types for python.
Shaounak Nasikkar
Mindmap von Shaounak Nasikkar, aktualisiert more than 1 year ago
Shaounak Nasikkar
Erstellt von Shaounak Nasikkar vor mehr als 4 Jahre
50
0

Zusammenfassung der Ressource

Data Structures - Abstract Data Types
  1. The Queue

    Anmerkungen:

    • Queue is recursive data structure Items are added at the back of the queue
    • FIFO Queue preserves order.
    • We can only access the data from one place.
    • Process the information in the same order they were received.
    1. size
      1. O(1)
      2. peek

        Anmerkungen:

        • Return the last item, which is front most item in the Queue.
        • return self.items[-1]
        1. O(1)

          Anmerkungen:

          • if self.items:     return self.items[-1]
        2. is_empty

          Anmerkungen:

          • return self.items == []
          • Returns a boolean value representing if the Queue is empty
          1. O(1)
          2. enqueue

            Anmerkungen:

            • -- insert the item at the 0th position
            1. O(n)

              Anmerkungen:

              • The runtime is O(n) or linear time because inserting into the 0th index of the list enforces all the items to be pushed.
            2. dequeue

              Anmerkungen:

              • Returns and removes the front most item from the Queue
              • self.items.pop()
              1. O(1)
            3. Stack

              Anmerkungen:

              • LIFO
              1. push
                1. O(1)
                2. pop
                  1. O(1)
                  2. peek

                    Anmerkungen:

                    • Show us the next value which can be popped
                    1. O(1)

                      Anmerkungen:

                      • Indexing in the list is constant time
                    2. size

                      Anmerkungen:

                      • Just use the length method of the list
                      1. O(1)

                        Anmerkungen:

                        • The method runs in constant time
                      2. is_empty
                        1. O(1)
                      3. Deque

                        Anmerkungen:

                        • Can add items to both ends.
                        • mutable and needs ordered collection of data structures. Can be implemented using list.
                        • limited access datatype
                        • If the string is palindrome. deque data structures is best.
                        1. add_front

                          Anmerkungen:

                          • Inserting the items to the 0th position
                          1. O(N)
                          2. add_rear

                            Anmerkungen:

                            • Just append the item. Constant runt time as the items are added to the end.
                            1. O(1)
                            2. remove_front

                              Anmerkungen:

                              • Just use Lists builtin pop method and pass 0
                              1. O(N)
                              2. remove_rear
                                1. O(1)

                                  Anmerkungen:

                                  • Just use the lists pop method without any argument
                                2. peek_front

                                  Anmerkungen:

                                  • Return the item at list index 0th position.
                                  1. O(1)
                                  2. size

                                    Anmerkungen:

                                    • Return the length of self.items
                                    1. O(1)
                                      1. O(1)

                                        Anmerkungen:

                                        • Just use the length fuction
                                      2. is_empty
                                        1. O(1)
                                        2. peek_rear

                                          Anmerkungen:

                                          • return the item at -1 index for getting the last item from the list
                                          1. O(1)
                                        Zusammenfassung anzeigen Zusammenfassung ausblenden

                                        ähnlicher Inhalt

                                        Data Structures & Algorithms
                                        Reuben Caruana
                                        F453 Data Structures - Stacks and Queues
                                        harvs899
                                        F453 Data Structures - Binary Trees
                                        harvs899
                                        Computer Science: Structures: GCSE
                                        louisewright528
                                        Data representation, types and structures
                                        bubblesthelabrad
                                        Patient Record System- UOP-DBM/381-WEEK5
                                        j03garcia
                                        Glosario-EstructuraDeDatos
                                        Eduardo Saldaña
                                        Data types and structures, F452 Computing
                                        Rakib
                                        linked list
                                        aaryan chaturvedi