Questions tagged [insertion]

place into or between other items in an enumeration

527 questions
-2
votes
3 answers

How to insert new node in a singly linked list after nth position?

OKay, so I want to insert a new node in a singly linked list in C at the nth position(not end or beginning), but all I get after searching is that how to insert new nodes at beginning or end of a linked list. Any help is appreciated. Thanks.
-2
votes
1 answer

Sorted Linked list not working properly in C

Completely new to C, im trying to make a linked list in C that sorts a pre existing char array alphabetically. Each char is assigned an index. So the listInsert function should insert each string into the linked list and sort them alphabetically, so…
-2
votes
1 answer

Insert number to a list

I have an ordered dictionary like following: source =([('a',[1,2,3,4,5,6,7,11,13,17]),('b',[1,2,3,12])]) I want to calculate the length of each key's value first, then calculate the sqrt of it, say it is L. Insert L to the positions which can be…
xlk3099
  • 15
  • 3
-2
votes
1 answer

INSERT INTO mysql database not working

I am trying to do something really simple here. All I want to do is to insert information in MySQL Here is the code below for the form.
Feek
  • 9
  • 5
-3
votes
2 answers

How to insert an element starting the iteration from the beginning of the array in c?

I have seen insertion of element in array starting iteration from the rear end. But i wonder if it is possible to insert from the front
-3
votes
2 answers

C error: expression must be a modifiable lvalue

I get this error in C: expression must be a modifiable lvalue void bfInsertion(BloomFilter* bloomFilter,const char* elem,int elemLen) { int i = 1; while (i <= elem) { elem[i] = 1; i += 1; } return…
-3
votes
1 answer

insertion sort gives out the same array

hi im creating a tiny lotto program and the program needs to sort out the first 6 numbers of the dictionary using insertion sort and the last 2 using selection sort i have done the code and complied it but it give me the below set of result, the…
lokki
  • 1
-3
votes
2 answers

Insertion Sort Algorithm, using a small array

just wanted to know if the below is correct. I am trying to solve this using the insertion sort algorithm. I have tried to attempt the below array and have come up with these answers. Please could you let me know if this is correct, and if i have…
Abdul
  • 15
  • 5
-3
votes
4 answers

How to insert and display arraylist in java program?

This is the output of the program: Enter your last name: Dela Cruz Enter your first name: Juan Enter your course: BSCS Enter your year: 4th Year Display Array List [0] - Dela Cruz | Juan | BSCS | 4th Year Add More (y/n): if yes it will add more…
xdiver
  • 101
  • 1
  • 7
-4
votes
1 answer

What's wrong with my code? It shows an unwanted result

#include #define ll unsigned long long int using namespace std; ll solve(ll arr[], ll n, ll b, ll x, ll pos) { if(n == b) return n; ll idx = pos - 1; for(ll i = n -1; i >= idx; --i) { arr[i + 1] = arr[i]; } …
rocz you
  • 13
  • 3
-4
votes
4 answers

Array size redefinition

So basically according to definition of array we cannot change array size. But if I am adding element to a same array by shifting other elements to the right of array, so the array size is going to increase. How this is…
-4
votes
1 answer

Validation not working in PHP on submission the form data by click the submit button

Validation not working in php on submission the form data by click the submit button.
-4
votes
1 answer

Java insertion sort not working properly

enter image description here This is the code screenshot link. I am edit many time but every time the output is not completely sorted.
-4
votes
1 answer

heap sort may be considered as insertion sort or selection sort done on a heap data structure instead of a list? Which one will it be?

Heap sort may be considered as A. Insertion sort done on a heap data structure instead of a list. B. Selection sort done on a heap data structure instead of a list. C. Bubble sort done on a heap data structure instead of a list. D. None of the…
-4
votes
2 answers

implement binary tree and make it balanced

how to do insert random integer between 1 and 10000 to the tree?? I just using scanner.in in code below private BinaryTree insert(BinaryTree node, int value) { if (node == null) node = new BinaryTree(value); else { …
1 2 3
35
36