Data Structures - Abstract Data Types

Descripción

This mind map entails all the Abstract Data Types for python.
Shaounak Nasikkar
Mapa Mental por Shaounak Nasikkar, actualizado hace más de 1 año
Shaounak Nasikkar
Creado por Shaounak Nasikkar hace más de 4 años
50
0

Resumen del Recurso

Data Structures - Abstract Data Types
  1. The Queue

    Nota:

    • 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

        Nota:

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

          Nota:

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

          Nota:

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

            Nota:

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

              Nota:

              • 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

              Nota:

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

              Nota:

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

                    Nota:

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

                      Nota:

                      • Indexing in the list is constant time
                    2. size

                      Nota:

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

                        Nota:

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

                        Nota:

                        • 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

                          Nota:

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

                            Nota:

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

                              Nota:

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

                                  Nota:

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

                                  Nota:

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

                                    Nota:

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

                                        Nota:

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

                                          Nota:

                                          • return the item at -1 index for getting the last item from the list
                                          1. O(1)
                                        Mostrar resumen completo Ocultar resumen completo

                                        Similar

                                        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