Tags » Linked List

(Leetcode) Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative.

For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL. 104 more words

Leetcode

CC150 - 2.6 Looped Linked List

Given an circular linked list, implement an algorithm which returns the node at
the beginning of the loop.
DEFINITION
Circular linked list: A (corrupt) linked list in which a nodes’s next pointer points… 62 more words
CTCI

Introduction to Linear data Structures

Which data Structure is can be called as linear Data Structure ?

Data Structure is called linear, If its elements form a Sequence.

  • Array

This is most commonly used linear data structure, used for collection of sequential data to be stored and accessed using index. 264 more words

Data Structures&Algorithms

Priyam agarwal

jhgasgdjhfgkAWGFASDBF TL,78OFgfkadusgfsdgshg

Linked List

Source Code Linked List Module

Berikut adalah Source Code dari materi Linked List untuk tugas saya.

Class :

class SimpleSLLModulPraktikum
    attr_accessor :head, :tail

      class Node
        attr_accessor :data, :pnext

        #method inisialisasi class Node
        def initialize(nilai)
          @data=nilai
          @pnext=nil
        end
      end

      #method inisialisasi class SimpleSLL
      def initialize
        @head=nil
        @tail=nil
      end

      #method untuk mengecek apakah linked list kosong atau tidak
      def isEmpty
             if @tail==nil and @head==nil  
               return true
             else
               return false
             end
     end

    #method untuk menambah Node di bagian belakang linked list 
     def append(data)    
              baru=Node.new(data)  # membuat objek node BARU
              if isEmpty      # cek apakah Linked List kosong
                @head=baru    # node BARU sebagai HEAD
                @tail=baru    # node BARU sebagai TAIL
              else      # jika Linked List tidak kosong
                @tail.pnext=baru    # sambungkan TAIL dengan BARU
                @tail=baru    # jadikan node BARU sebagai TAIL
              end
      end

      def view
             temp=@head
             while temp!=nil
               puts temp.data
               temp=temp.pnext
            end
      end

        #method untuk mengambil data pada posisi terakhir
        def extract_last
          temp=@head
            while temp.pnext.pnext!=nil    # cari node sebelum tail
               temp=temp.pnext
            end
            result=temp.pnext
            temp.pnext=nil
            @tail=temp
            return result.data
        end
end…
40 more words
Ruby Progamming

Reversing the linked list in c | source code

#include<stdio.h>
#include<malloc.h>

//prototypes or declarations of functions
void append();
void display();
void reverse_list();

struct node
{
int data; //to hold the value of node
struct node *next;//to hold the next node pointer… 199 more words
C

DATA STRUCTURE

  •  Data structure is an arrangement of data in a computer’s memory or even disk storage. An example of several common data structures are arrays, linked lists, queues, stacks, binary trees, and hash tables.
  • 289 more words
Programming In Java