Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nandni #606

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Geeks DSA.pdf
Binary file not shown.
Binary file added Screenshot (634).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot (644).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot (645).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot (646).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot (647).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions nandni25/dsa1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import java.util.*;
import java.io.*;

class Node {
Node left;
Node right;
int data;

Node(int data) {
this.data = data;
left = null;
right = null;
}
}

class Solution {


public static void inOrder(Node root) {
Deque<Node> stack = new ArrayDeque<Node>();
while(!stack.isEmpty() || root!=null){
if(root!=null){
stack.push(root);
root = root.left;
}else{
root = stack.pop();
System.out.print(root.data+" ");
root = root.right;
}
}
}

public static Node insert(Node root, int data) {
51 changes: 51 additions & 0 deletions nandni25/dsa2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

// Complete the reverseArray function below.
static int[] reverseArray(int[] a) {


}

private static final Scanner scanner = new Scanner(System.in);

public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

int arrCount = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

int[] arr = new int[arrCount];

String[] arrItems = scanner.nextLine().split(" ");
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

for (int i = 0; i < arrCount; i++) {
int arrItem = Integer.parseInt(arrItems[i]);
arr[i] = arrItem;
}

int[] res = reverseArray(arr);

for (int i = 0; i < res.length; i++) {
bufferedWriter.write(String.valueOf(res[i]));

if (i != res.length - 1) {
bufferedWriter.write(" ");
}
}

bufferedWriter.newLine();

bufferedWriter.close();

scanner.close();
}
}
4 changes: 4 additions & 0 deletions nandni25/dsa3
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def print_list(head):
if head is not None:
print(head.data)
print_list(head.next)
14 changes: 14 additions & 0 deletions nandni25/dsa4
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int d = scan.nextInt();
int[] array = new int[n];
for(int i=0; i<n;i++) {
array[(i+n-d)%n] = scan.nextInt();
}
for(int i=0; i<n;i++) {
System.out.print(array[i] + " ");
}
}
}
25 changes: 25 additions & 0 deletions nandni25/dsa5
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Node* InsertNth(Node *head, int data, int position)
{
Node *newNode = (Node*)malloc(sizeof(Node));
newNode->data = data;

if (head == NULL) {
return newNode;
}

if (position == 0) {
newNode->next = head;
return newNode;
}

Node *currentNode = head;
while (position - 1 > 0) {
currentNode = currentNode->next;
position--;
}

newNode->next = currentNode->next;
currentNode->next = newNode;

return head;
}
2 changes: 2 additions & 0 deletions nandni25/readme.n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nandni asati 19bce10445
btech cse core