250 Topics

Member Avatar for
Member Avatar for mystycs

Is there a way to sort a vector with a class that has an int variable? I want to have my vector sorted and printed in console. I want to be able to sort the vectors. Say i create a bunch of vectors here on user input `vector<PCB> Disks2[DiskDevices];` Basically …

Member Avatar for Schol-R-LEA
0
414
Member Avatar for michelle.trinsky

I'm trying to create a sorted linked list without using Collections. I don't want to use Collections since I'd like to learn how to work with Linked List manually. I'm getting NullPointer exception when I'm comparing strings and comparison <0. Any suggestions and help are appreciated. This is the part …

Member Avatar for stultuske
0
1K
Member Avatar for Hector_2

I can't get the code to display in an ordered list. // Chapter 5 - Homework Assignment #include <iostream> #include <cstdlib> using namespace std; // // DECLARE FUNCTION HEADER FOR // CLASS ListNode class ListNode { public: ListNode(double v, ListNode *p) { value = v; next = p; } private: …

Member Avatar for Hector_2
0
190
Member Avatar for knan

I have a dictionary [CODE]dict1={'18':['4000','1234'],'12':['7000','4821','187','1860','123','9000']}[/CODE] I want to sort the keys and values such that, the output is, [CODE]dict1={'12':['123','187','1860','4821','7000','9000'],'18':['1234','4000']}[/CODE] I tried something! but it didn work [CODE]>>> for values in dict1: ... dict1[values].sort() ... >>> dict1 {'18': ['1234', '4000'], '12': ['123', '1860', '187', '4821', '7000', '9000']}[/CODE] Full sorting happens for …

Member Avatar for grantjenks
0
806
Member Avatar for Thevenin

I am trying to order by date DESC some events read from a CSV and print out them. The CSV file has to be read until it reaches the end and then order by date DESC only the entries in the following categories: champions and euro. This is the code …

Member Avatar for Thevenin
0
2K
Member Avatar for chrisl007

Hello, as it can be inferred from profile, I am new. I have read the community guidelines and I have done prior research. I am a very weak coder(through my own fault). However, I like to believe I firm conceptual understanding. **So What is my problem?** I have an assignement …

Member Avatar for chrisl007
0
223
Member Avatar for murali2489

Hi Team, Im reading collections and there is a topic called Backed Collections. I could not understand the output below . Please throw some light on it. TreeMap<String,String> map = new TreeMap<String,String>(); map.put("a","ant"); map.put("d","dog"); map.put("h","horse"); SortedMap<String,String> submap; submap = map.subMap("b","g"); System.out.println(map + " " + submap); map.put("b", "bat"); submap.put("f","fish"); map.put("r", …

Member Avatar for murali2489
0
232
Member Avatar for Iikeloa

Hi I"m sorry that there is no code, it's just a question in my mind .. How can I sort the request results as rows.In every row 4 results then the next row 4 results and so on.?

Member Avatar for Iikeloa
0
140
Member Avatar for yann.bohbot.9

Hi there everyone, I'm a bit new to see and I need your help please. I'm stuck with a merge sort problem where it's support to sort my nodes in lexicographical order. Can you please have a look on my code because i've posted everywhere and i'm not getting the …

0
242
Member Avatar for hassai

Hi what is the solution ? i have a file like this : 0 1 2 C 10 1 2 S 7 1 2 C 11 1 2 S 9 3 43 C 10 3 43 S 1 3 43 C 101 3 43 S with this code : ifstream …

Member Avatar for Schol-R-LEA
0
264
Member Avatar for dougy83

Hi all, Does anyone know how to quickly (i.e. O(log n) time) insert items into a sorted list? I'd prefer an existing working function if available; I didn't see any appropriate ones in boost or stl. Some background: I'd like to keep a constant sized sorted list, and insert items …

Member Avatar for dougy83
0
13K
Member Avatar for varun gaba

hey i am facing a problem in sorting the post.I want that when a user click on **NAME** button then all post display by name.Then if user want to print the post by the latest date.Then it click on **DATE** button.How is it possible .what will i do in wordpress...

Member Avatar for patk570
0
163
Member Avatar for H_beginner

Can any one tell me what I am doing wrong. I am sorting a single linked list. void ll::sort() { for(int i=0;i<size-1;i++) {node *cptr = fptr; for(int j= 0;j<size-1;j++) { if((cptr->no) > (cptr->nxt->no)) { if(cptr == fptr) { node *c2ptr = cptr->nxt; cptr->nxt=c2ptr->nxt; c2ptr->nxt=cptr; fptr = c2ptr; } else { …

Member Avatar for richieking
0
307
Member Avatar for ariel930

Hi,I am having a hard time trying to do insertion sort on a singly link list containing single alphabets.I have spent hours doing this but still it wont work.Any help will be apprecited. Here is my code: # include <iostream> using namespace std; class node { public: char info; node …

Member Avatar for richieking
0
5K
Member Avatar for Waseemaburakia

I'm trying to modify a Bibblesort code I'm writing that will count the number of instances and print out a seperate line for each instance and how many occurances it had. def BubbleSortList(MyList): ComparisonCounter = 0 for j in range ( len(MyList)): for i in range ( len(MyList)-1-j ): if …

Member Avatar for Waseemaburakia
0
289
Member Avatar for mehdix

Hi All, I was assigned to code a project which to some extend simulates timetable of an airport. This has to be implemented using linkedLists. The poject should consist of Node class and SLL (singly linked list) class. The logic of the project is like this: There should be a …

Member Avatar for deceptikon
0
273
Member Avatar for vegaseat

A Python sort with a helper function to allow for mixed order sort like age descending and weight ascending.

3
490
Member Avatar for coiseng

Hi, I'm newbie with C++ and I found an example which I need http://ideone.com/Eikbr4 But I've a question, how do I seperate this piece of code into .h and .cpp.. I tried to do something similar on my own but I'm having struggling with it after multiple try.. I've read …

Member Avatar for tinstaafl
0
313
Member Avatar for cgull

Hello, I have an array that I need to sort by keys. The array looks like this: Array ( [0] => Array ( [question_title] => Question 8 [question_description] => [type_id] => 1 [type_title] => Yes/No [question_number] => 8 ) [1] => Array ( [question_title] => Question 9 [question_description] => [type_id] …

Member Avatar for cereal
0
285
Member Avatar for vegaseat

This short snippet shows you how to preprocess a text to remove punctuation marks, then do a word frequency count using Counter() from the Python module collections. Finally, two sorts are applied to display words with matching frequency in alphabetical order.

2
655
Member Avatar for t_thakar

Hi all I know how to sort an array but I dont know how to sort an array according to a value in the second array... <?php $array1 = array( array('name'=>'01','number' => 1), array('name'=>'07','number' => 7), array('name'=>'05','number' => 5), array('name'=>'06','number' => 6), array('name'=>'02','number' => 2), array('name'=>'03','number' => 3), array('name'=>'11','number' => …

Member Avatar for t_thakar
0
409
Member Avatar for gaurav23

#include<fstream.h> #include<conio.h> #include<string.h> #include<stdio.h> void main() { clrscr(); ofstream fout("a"); fout<<5<<"\n"<<3<<"\n"<<2<<"\n"<<4<<"\n"<<1; fout.close(); ifstream fin("a"); int i,j,k,l=0,m,n,o; while(fin) { fin>>i; l++; } l--; fin.close(); fstream fin1("a",ios::ate,ios::in); fin1.seekg(0); for(i=0;i<l-1;i++) { for(j=0;j<l-i-1;j++) { o=fin.tellg(); fin1>>m; fin1>>n; if(m>n) { fin1.seekg(o); fin1<<n; fin1<<m; fin1.seekg(o+1); } } } } //file sorting is not working if anyone …

Member Avatar for gaurav23
0
221
Member Avatar for ddanbe

Put on your dancing boots and let the violins play! [Click Here](http://www.youtube.com/watch?v=ywWBy6J5gz8)

Member Avatar for ddanbe
0
105
Member Avatar for Mantroskylo

This is an assingment i've been working on but since this is a merge between two previous developments i need a little help solving my issue here that would be highly appreciated. In a nutshell what this program needs to do is recieve a .txt file create a vector holding …

Member Avatar for rubberman
0
287
Member Avatar for ej.p.lopez

good day can anyone help me with my sort by? nothing happens when clicking the sort no errors tried the codes 4 years ago don't know if it's still usable the sql.= i think don't work or my other query just disables it. here's my sql command thanks :D. help …

Member Avatar for broj1
0
238
Member Avatar for Kert

I need to sort tables with dynamical content with rails. I could use the RailsCast tutorial ([http://railscasts.com/episodes/228-sortable-table-columns](http://railscasts.com/episodes/228-sortable-table-columns)) but as I'm not using any specific method in a controller, it doesn't seem appropriate solution. I found out about the jquery tablesorter, but it doesn't seem to work. Where the solution might …

Member Avatar for paulkd
0
191
Member Avatar for seacase

I am trying to modify my shell sort algorithm to use Hibbard's increments rather than n/2. I know that Hibbard's increments are 2k - 1, but I can't figure out how to incorporate that into my algorithm. Any suggestions to help me move forward with this? I feel like I …

Member Avatar for Mohamed_22
0
4K
Member Avatar for chandub

hai every one , i have problem with order by decimal number I have revision number column it contains revision number like 1, 2, 2.1, 2.2, 2.3 ...... 2.10 2.11 ... and am trying to order by revision it's giving sort order like 1, 2, 2.1 2.10 2.11 ... 2.2 …

Member Avatar for pritaeas
0
185
Member Avatar for joeydal

I need to be able to display whether or not a person searched for "is a friend" if found in the file and "isn't a friend" if not found in the file. I also need to continue processing names until "END" is typed in. Any help would be appreciated! #include …

Member Avatar for tinstaafl
0
179
Member Avatar for bluekb

#include <stdio.h> #include <stdlib.h> #include <string.h> #define FILE_NAME 20 #define LIST_SIZE 50 typedef struct { char *name; int score; }RECORD; float calMean(RECORD list[], int count); void sortData(RECORD list[], int count); int main (void) { // Declarations float mean; float median; FILE *fp; char fileName[FILE_NAME]; RECORD list[LIST_SIZE]; char buffer[100]; int count …

Member Avatar for bluekb
0
159

The End.