ivanseidel / ivanseidel/LinkedList

Linked_listC++

Open
#59 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
364
Forks
117
PR merge metrics
No merged PRs in 30d

Description

class linked_list{
struct node{//عملنا العقدة حقنا
int data;
node* next;};
node* head=NULL;
public:
// دالة اضافة عنصر الى اخر القائمة
void apend_to_last(int val){
node* newnode=new node;
newnode->data=val;
newnode->next=NULL;
if(head==NULL)
head=newnode;
else{
node* temp=head;
while(temp->next!=NULL)
temp=temp->next;
temp->next=newnode;}}
//دالة البحث عن القيمة التي ادخلها المستخدم وحذفها
void delete_by_val(int val){
if(head==NULL)
{cout<<"no elements in linked list...\n";
return;}

nodetemp;
temp=head;
if(temp->data==val){
head=head->next;
delete temp;}
else{
node
prev,temp;
prev=temp=head;
while(temp!=NULL&&temp->data!=val){
prev=temp;
temp=temp->next;}
if(temp==NULL)
{cout<<"not found \n";
return;}
else{
prev->next=temp->next;
delete temp;}}}
//دالة عرض عناصر القائمة المتصلة
void display(){
if(head==NULL){
cout<<"no element in linked list...\n";
return;}
node
temp=head;
while(temp!=NULL){
cout<data<<"\t";
temp=temp->next;}}
//دالة اضافة قيمة معينة الى موقع معين
void insrt_by_pos(int pos,int val){
node* newnode=new node;
newnode->data=val;
newnode->next=NULL;
if(pos==0){
newnode->next=head;
head=newnode;}
else{
nodetemp=head;
for(int i=0;i<pos-1&&temp->next!=NULL;i++ )
temp=temp->next;
newnode->next=temp->next;
temp->next=newnode;}}
//دالة حذف قيمة في موقع معين
void delete_by_pos(int pos){
if(head==NULL){
cout<<"no element in linked list..\n";
return;}
if(pos==0){
node
temp=head;
head=head->next;
delete temp;}
else {
nodetemp=head;
for(int i=0;i<pos-1&&temp->next!=NULL;i++)
temp=temp->next;
if(temp->next==NULL){
cout<<"ERORR enter corect position...\n";
return;}
node
temp2=temp->next;
temp->next=temp->next->next;
delete temp2;}}
//دالة عرض القائمة بالعكس
void revers(){
if(head==NULL){
cout<<"no element in linked list...\n";
return;}
node* prev=NULL;
nodecurr=head;
node
next=NULL;
while(curr!=NULL){
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;}
head=prev;}};

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue contains a standalone C++ linked-list implementation but names no repository file, test, or requested change. First clarify whether this code is intended for the Arduino library and what behavior or integration is required; completion criteria are not specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.