Data Structures 03

Today we are talking about: LINKED LIST IMPLEMENTATION

Linked List

  • there are 2 types of linked list; they are Stack (LIFO) and Queue (FIFO).
  • push and pop are linked list functions that are used when adding and clearing datas, push for adding a data, pop for clearing or delete a data.
  • there are single and double linked list.

What are the differences between stack and queue?

  • Stack:
    • First in, last out
    • Last in, first out
  • Queue:
    • First in, first out
    • Last in, last out
    • there is a queue called priority Queue = first in not always first out according to the prioritiness.

Push and Pop

  • Push – is also called enstack in stack and enqueue in queue is for adding datas into the linked list.
  • Pop – is also called destack in stack and dequeue in queue is for delete datas in the linked list.

Single and Double Linked List

  • Single
    • single linked list is a one direction linked list, it only goes to one next either right or left according to the programmer
  • Double
    • Double linked list is a 2 direction linked list, it has a next and a prev, meaning it will be easier to add data in anywhere.

INFIX, POSTFIX, AND PREFIX NOTATION

  • Infix notation (commonly used) usually we used it in maths equation
  • Prefix notation, also known as Reverse Polish notation.
  • Postfix notation, also known as Polish notation.

Infix: operator is written between operands example 3+12

Prefix: operator is written before operands example + 3 12

Postfix: operator is written after operands example 3 12 +

Why must prefix and postfix exist?

  • Prefix and postfix notations dont need brackets to prioritize operator precedence.
  • Prefix and postfix is much easier for computer to evaluate.

SEARCHING

  • Deep First Search : searching to the deepest data first then just going up
  • Breadth First Search : searching side to side.

Leave a Reply

Your email address will not be published. Required fields are marked *