Data structure
479 subscribers
187 photos
75 files
16 links
قناة للاستفادة فيها مجموعة امتحانات و افكار متنوعة حالهم
وصور من محاضرات أ.خيرالله الفرجاني
موفقين
لأي استفسار
@Ali_Marghni
Download Telegram
void Add_First(int key) {
Node q=new Node();
q.id=key;
System.out.println("enter name");
q.name=sc.next();
System.out.println("enter gpa");
q.gpa=sc.nextDouble();
q.next=Head;
Head=q;
}
void add_last(int key) {
loc=Head;
while(loc.next!=null){
loc=loc.next; }

Node q=new Node();
q.id=key;
System.out.println("enter name");
q.name=sc.next();

loc.next=q;
q.next=null;
}
void Delete_last(){
loc=Head;
pred=null;
while (loc.next!=null)
{
pred=loc;
loc=loc.next;
}
pred.next=loc.next;
}
void swap_first_second()
{
Node temp=Head.next; Head.next=temp.next;
temp.next=Head;
Head=temp;
}
void reseve()    {
  loc=Head;       
pred=null;
        while(loc!=null)   
     {
 Node Temp=loc.next;            loc.next=pred;
pred=loc; 
loc=Temp;
        } 
       Head=pred;
    }