diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..ed27eae Binary files /dev/null and b/.DS_Store differ diff --git a/himanshi-khatri-skit-B230490/.DS_Store b/himanshi-khatri-skit-B230490/.DS_Store new file mode 100644 index 0000000..26dd160 Binary files /dev/null and b/himanshi-khatri-skit-B230490/.DS_Store differ diff --git a/himanshi-khatri-skit-B230490/.vscode/c_cpp_properties.json b/himanshi-khatri-skit-B230490/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..980fd57 --- /dev/null +++ b/himanshi-khatri-skit-B230490/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "macos-clang-arm64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/clang", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "macos-clang-arm64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/himanshi-khatri-skit-B230490/.vscode/launch.json b/himanshi-khatri-skit-B230490/.vscode/launch.json new file mode 100644 index 0000000..ee1eb3e --- /dev/null +++ b/himanshi-khatri-skit-B230490/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "lldb", + "request": "launch", + "args": [], + "cwd": "/Users/himanshi/Documents/GitHub/CSR/himanshi-khatri-skit-B230490", + "program": "/Users/himanshi/Documents/GitHub/CSR/himanshi-khatri-skit-B230490/build/Debug/outDebug" + } + ] +} \ No newline at end of file diff --git a/himanshi-khatri-skit-B230490/.vscode/settings.json b/himanshi-khatri-skit-B230490/.vscode/settings.json new file mode 100644 index 0000000..85b81c7 --- /dev/null +++ b/himanshi-khatri-skit-B230490/.vscode/settings.json @@ -0,0 +1,62 @@ +{ + "C_Cpp_Runner.cCompilerPath": "clang", + "C_Cpp_Runner.cppCompilerPath": "clang++", + "C_Cpp_Runner.debuggerPath": "lldb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false, + "files.associations": { + "ostream": "cpp" + } +} \ No newline at end of file diff --git a/himanshi-khatri-skit-B230490/project-1/abc.txt b/himanshi-khatri-skit-B230490/project-1/abc.txt new file mode 100644 index 0000000..dd31c89 --- /dev/null +++ b/himanshi-khatri-skit-B230490/project-1/abc.txt @@ -0,0 +1,3 @@ +him +89 +67 diff --git a/himanshi-khatri-skit-B230490/project-1/circularLL.cpp b/himanshi-khatri-skit-B230490/project-1/circularLL.cpp new file mode 100644 index 0000000..e69de29 diff --git a/himanshi-khatri-skit-B230490/project-1/doubly_linkedlist b/himanshi-khatri-skit-B230490/project-1/doubly_linkedlist new file mode 100755 index 0000000..6349877 Binary files /dev/null and b/himanshi-khatri-skit-B230490/project-1/doubly_linkedlist differ diff --git a/himanshi-khatri-skit-B230490/project-1/doubly_linkedlist.cpp b/himanshi-khatri-skit-B230490/project-1/doubly_linkedlist.cpp new file mode 100644 index 0000000..07b33e4 --- /dev/null +++ b/himanshi-khatri-skit-B230490/project-1/doubly_linkedlist.cpp @@ -0,0 +1,174 @@ +#include +using namespace std; +class node{ + public: + int data; + node*prev; + node*next; +// constructor +node(int data){ + this->data=data; + this->prev=NULL; + this->next=NULL; +} +~node(){ + int value=this->data; + if(next!=NULL){ + delete next; + next=NULL; + } + cout<<"memory free for node with data"<data<<"\t"; + temp=temp->next; + } + cout<next; + } + return len; + + +} + void insertAtHead(node*&tail,node*&head,int item){ + if(head==NULL){ + node*temp=new node(item); + head=temp; + tail=temp; + } + else{ + node*newnode= new node(item); + newnode->next=head; + head->prev=newnode; + head=newnode; + + } + + } + void insertAtTail(node* &tail,node*&head,int item){ + if(tail==NULL){ + node*temp=new node(item); + tail=temp; + head=temp; + } + else{ + node* newnode= new node(item); + newnode->next=NULL; + tail->next=newnode; + tail=newnode; + } + + } + void insertAtPosition(node*&head,node*&tail,int item,int pos){ + int count; + node*temp=head; + // position is 1 + if(pos==1){ + insertAtHead(tail,head,item); + return; + } + // position is any + else{ + node*newnode= new node(item); + while(countnext; + count++; + } + newnode->next=temp->next; + temp->next=newnode; + temp=newnode; + } + // position is last + if(temp->next==NULL){ + insertAtTail(tail,head,item); + return; + } + // creating a node for item + node*nodeToInsert=new node(item); + nodeToInsert->next=temp->next; + temp->next->prev=nodeToInsert; + temp->next=nodeToInsert; + nodeToInsert->prev=temp; + + + + + } +// deletion of doubly ll +void deleteNode(int pos,node*&head){ + // deleting starting node + if(pos==1){ + node*temp=head; + temp->next->prev=NULL; + head=temp->next; + temp->next=NULL; + delete temp; + } + // deleting node in middle + + else{ + node*curr=head; + node*prev=NULL; + int count=0; + while(countnext; + count++; + + } + curr->prev=NULL; + prev->next=curr->next; + curr->next=NULL; + delete curr; + + } +} +int main(){ + node*head=NULL; + node*tail=NULL; + + + print(head); + // int n=getLength(head); + // cout< +#include +#include +using namespace std; +int main() +{int n; + fstream of1("number.txt",ios::out); + fstream of2("odd.txt",ios::out); + fstream of3("even.txt",ios::out); + + + cout<<"enter number of data required: \n"; + cin>>n; + int i=1; + cout<<"enter numbers \n"; +int num; + while(i<=n){ + cin>>num; + of1<