place into or between other items in an enumeration
Questions tagged [insertion]
578 questions
-1
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.

Anony Mous
- 23
- 2
-1
votes
1 answer
Multiple insertion operator << in C++
I write a small code to see what happen if I use series insertion operators to own class.
#include
using namespace std;
class MyClass
{
public:
int i;
MyClass & operator<< ( const string & );
} ;
MyClass&…

Chiat-Chhàn Âng
- 21
- 2
-1
votes
1 answer
MySQLi and PHP sends only single products on the database
I can't find where is the problem at my code. It only send single orders to the database. When I order in my cart 2 or more than items, it only sends the last order. I don't have any idea how I can change or add some syntax in my code.
Here is my…

None other
- 1
- 1
- 2
- 10
-2
votes
1 answer
A recursive insertion method with a logic error
I wrote a recursive insertion method that inserts a number in a list of ascending numbers and reserves the list order. It's simple and it works, the problem is that it doesn't return the right list and duplicates it when the number I want to insert…

momcomepickmeup
- 1
- 1
-2
votes
1 answer
OpenCv showing error while resizing written image
def face_cropped(img):
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
faces = face_classifier.detectMultiScale(gray,1.3,5)
#scaling factor = 1.3
#minimum neighbor = 5
…
-2
votes
1 answer
adding list as a sublist in a nested list at the start of the nested list Python
given a nested list:
input_list = [['c', 'd'], ['e', 'f']]
addition_to_input_list = ['a', 'b']
required_output = [['a', 'b'], ['c', 'd'], ['e', 'f']]
for my current program, it is enough to put the addition at the start, in the future I may have…

Zenith_1024
- 231
- 2
- 14
-2
votes
2 answers
Insertion sort program in python
I implemented insertion sort and it worked. But while using a different condition I am confused. I feel should also work correctly but its not working
def insertion(arr):
for i in range(1,len(arr)):
value = arr[i]
j=i-1
…

Manish Singh
- 11
- 3
-2
votes
2 answers
Why do return boolean value in this line std::unordered_map<>.insert().second in C++
std::unordered_map url;
url.insert(std::pair("google","www.google.co.kr"));
bool ok = url.insert(std::pair("google","www.google.com")).second;
std::cout << (ok ?…

Kwon34
- 11
-2
votes
1 answer
Input/Output Operators Overloading in C++
Stuck with ostream/istream operator overloading
Q1. why we are using ostream& operator as friend?
Q2. Why we are passing two arguments in ostream & operator << (ostream &out, const Complex &c)
Q3. why we are referencing to Cout and in ? istream &…

Prabal Jain
- 7
- 3
-2
votes
1 answer
Why i am getting infinite loop
public void insertion(int data)
{
Node new_node = new Node(data);
if(head==null)
{
head=new_node;
}
new_node.next=head;
head=new_node;
}
I want to insert the new_node when head is…
-2
votes
2 answers
How to get to the Nth node in the Linked list?
I want an explanation for how I can get to the Nth node in the linked list as to insert a node after that Nth node I have this piece of code and the function for inserting a node after the nth node is given as
InsertAfter
I have problem as how to…

dukeforever
- 298
- 1
- 7
-2
votes
1 answer
Insertion Sorting on doubly Linked List C++
I'm currently learning about many different ways of sorting data. I'm trying to implement insertion sort on doubly linked list using C++.
I understand the concept of using it on an array. But, i'm having difficult time figuring out why my "while"…

jvsper
- 41
- 4
-2
votes
3 answers
Insertion Sort With No Built In Functions
I'm trying to create an insertion sort program in python with no built in functions. The only problem is that my program will only sort the first item in a list. What am I doing wrong?
My sort
def insertionsort(list1):
for index in…

BecauseImBatmanFilms
- 19
- 3
-2
votes
2 answers
What is Wrong with my Binary Insertion Code?
I am a beginner in Java trying to create a class that implements the binary insertion sort and sorts out random arrays of the data sizes 50, 500, 5000, 50000, and 500000.
The program works fine when I implemented it as an insertion sort.
public…

chocotella
- 89
- 1
- 9
-2
votes
2 answers
Change numerical string to date format
I have the following dataframe with the date of 23/09/15 in a numerical string.
Date Session
230915 2
230915 2
230915 2
230915 2
230915 2
230915 2
I want to change the "Date" column so that it's…

Bonono
- 827
- 1
- 9
- 18