Skip to content

Commit

Permalink
updating the file contents for build to resolve build error
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishektripathi66 committed Nov 15, 2024
1 parent 603cb4c commit ae87159
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void findLevelSum(TreeNode root,int level){
* }
* }
*/
class Solution1 {
class MaximumLevelSumofaBinaryTree1 {
int maxSum;
int levels;
Map<Integer,Integer> m = new HashMap<>();
Expand Down
4 changes: 4 additions & 0 deletions src/Data Structures/Binary tree/binarytree.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Node class representing each element of the binary tree

import java.util.LinkedList;
import java.util.Queue;

class Node {
int nodedata;
Node left, right;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Node class representing each element of the doubly linked list
class Node {
class Nodec {
int data;
Node prev, next;
Nodec prev, next;

// Constructor to create a new node with a given data
public Node(int data) {
public Nodec(int data) {
this.data = data;
prev = next = null;
}
}

// DoublyLinkedList class for basic operations
public class DoublyLinkedList {
Node head;
Nodec head;

// Constructor to initialize an empty doubly linked list
public DoublyLinkedList() {
Expand All @@ -21,7 +21,7 @@ public DoublyLinkedList() {

// Insert a new node at the end of the doubly linked list
public void insert(int data) {
Node newNode = new Node(data);
Nodec newNode = new Nodec(data);

// If the list is empty, make the new node the head
if (head == null) {
Expand All @@ -30,7 +30,7 @@ public void insert(int data) {
}

// Otherwise, traverse to the end of the list
Node last = head;
Nodec last = head;
while (last.next != null) {
last = last.next;
}
Expand All @@ -44,7 +44,7 @@ public void insert(int data) {
public void delete(int data) {
if (head == null) return; // List is empty, nothing to delete

Node current = head;
Nodec current = head;

// Traverse the list to find the node to be deleted
while (current != null && current.data != data) {
Expand All @@ -71,7 +71,7 @@ public void delete(int data) {

// Traverse the list from the head to the end
public void traverseForward() {
Node current = head;
Nodec current = head;
System.out.print("Doubly Linked List (forward): ");
while (current != null) {
System.out.print(current.data + " ");
Expand All @@ -85,7 +85,7 @@ public void traverseBackward() {
if (head == null) return; // Empty list

// Traverse to the last node
Node last = head;
Nodec last = head;
while (last.next != null) {
last = last.next;
}
Expand All @@ -101,7 +101,7 @@ public void traverseBackward() {

// Search for a node with the given data
public boolean search(int data) {
Node current = head;
Nodec current = head;

// Traverse the list to find the data
while (current != null) {
Expand Down
3 changes: 0 additions & 3 deletions src/Data Structures/queue/Queue.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
package queue;


// Queue class implemented using an array
public class Queue {
int[] queue;
Expand Down
File renamed without changes.

0 comments on commit ae87159

Please sign in to comment.