Skip to main content

All Questions

Tagged with
0 votes
1 answer
56 views

understanding a part of recursion for a binary search tree

Hello I basically need to implement a recursive function for insertion of a binary tree. I already implemented the chunk of insertion function (wether it's largest or smaller than root) but there's an ...
Cool Dude's user avatar
0 votes
1 answer
95 views

How to pass array into parameters of function

I try to create alias in H2 for function with two parameters of array. parameters: Array sourceArray, Array subArray Returns boolean: TRUE if sourceArray contains all elements of subArray. OR ELSE ...
Евгений Дорджиев's user avatar
-1 votes
1 answer
57 views

Which is a good approach either to create an array of object or to create data members as an array? [closed]

I have used two approaches to solve the Question Here, Both Works But what i need to know is Which will be the Best to do Should I create an Array of Object or Should I create data members as an array ...
Rohit Kumar Chaurasiya's user avatar
0 votes
1 answer
99 views

merging 2 arrays in ascending order (leetcode)

class Solution{ public static void merge(int[] nums1, int m, int[] nums2, int n) { int[] result = new int[m + n]; int i = 0, j = 0, k = 0; while (i < m && j < n) { if ...
shivam0277's user avatar
0 votes
1 answer
30 views

where am ı doing wrong?

Elements in an entered array, without breaking their order, but singularly. Write a program that casts it into a new array. For example, if the input is {3, 3, 87,56,1, 87, 3, 2 } the output should be ...
Mustafa BAL's user avatar
1 vote
1 answer
31 views

When calling the printQueue method I want to print "O" for elements within the respective limits and without printing any "X" values beyond the limit

private void printQueue(String[] cashier1, String[] cashier2, String[] cashier3) { int maxQueueSize = Math.max(cashier1.length, Math.max(cashier2.length, cashier3.length)); int ...
Seniru Senarathne's user avatar
0 votes
1 answer
36 views

My max value wont display, but i cant see or figure out why

I am trying to find the maximum value a user has entered from a 1D array, but the function i have set up wont display a value. I usually use visual basic and have done limited java, so I'm new. public ...
skrubiks's user avatar
1 vote
1 answer
49 views

Array turns back to its original form after being modified inside a function

I was trying to do problem no. 189 in LeetCode but I encountered a problem. The code is as follows: public class Solution { public void rotate(int[] nums, int k) { k %= nums.length; ...
Wiscoteju's user avatar
0 votes
2 answers
299 views

I want to reverse an array but dont know why this error comes?

i dont kow ehy my programs dont run. i am trying to reverse my array through user defined function. i can give an input but cannot find out the answer. import java.util.*; public class reverseanarray{ ...
Bilal Sahi's user avatar
-1 votes
1 answer
53 views

how to store multiple different classes into one array

I am trying to make a pokemon text based clone for a school project and I need to store the 2 different pokemon that are fighting in a single array so I can easily compare and exchange stats instead ...
Aaron Baer's user avatar
0 votes
2 answers
54 views

can we return constructor at the end of function

i was solving a question on leetcode and came across the code which I'm having difficulty to understand and had searched through internet for answer but didn't found desired answer The Question is ...
kartik04's user avatar
0 votes
1 answer
48 views

I'm trying to make a function that takes a 2d array as a parameter and outputs a normal array containing every unique number, in java

The function needs to have a 2d array as a parameter and then return a normal array with all the unique numbers. If the 2d array is [ [1,1], [4,2] ] then it should output [1,4,2] I'm still pretty ...
Christopher F.'s user avatar
0 votes
1 answer
106 views

I'm trying to use a function to modify this 2d array to double the even numbers on the even rows and double the odd numbers on the odd rows

I'm trying to use a function to modify this 2d array to double the even numbers on the even rows and double the odd numbers on the odd rows. For instance if my 2d array is {1,3,6,2} ,{7,5,6,1} ,...
Christopher F.'s user avatar
1 vote
2 answers
63 views

Why do we initiate an object inside main function

class MergeSort { // Merge two subarrays L and M into arr void merge(int arr[], int p, int q, int r) { } // Divide the array into two subarrays, sort them and merge them void ...
Tanmay Chavan's user avatar
-2 votes
1 answer
54 views

Needed to create a function thet recieves an array of 2 degits nums , Switch between the digits and print but got an error

Write a function that receives double-digit numbers, until a number that is not double-digit is received. • For each number received the program will generate a reverse number and print it. For ...
Aviad tech's user avatar

15 30 50 per page
1
2 3 4 5
12