Basically im creating a list which contains names(strings), but as i add a struct to my list, i want to place it alphabetically.
im just having trouble especially with reassigning the pointers as i add
How can i do this in C?
thanks.
I've got a List that contains duplicates and I need to find the indexes of each.
What is the most elegant, efficient way other than looping through all the items. I'm on .NET 4.0 so LINQ is an option. I've done tons of searching and connect find anything.
Sample data:
var data = new List{"fname", "lname", "home", "home", "company"}();
I need to get the indexes of "home".
Hi
I have found this code in the internet and it was for arrays ,I want to change it for doubly linked list(instead of index we should use pointer) would you please help me that how can i change merge method(I have changed sort method by myself) also this is not my home work ,I love working with linked list!!
public class MergeSort {
private DoublyLinkedList LocalDoublyLinkedList;
public MergeSort(DoublyLinkedList list) {
LocalDoublyLinkedList = list;
}
public void sort() {
if (LocalDoublyLinkedList.size() <= 1) {
return;
}
DoublyLinkedList listOne = new DoublyLinkedList();
DoublyLinkedList listTwo = new DoublyLinkedList();
for (int x = 0; x < (LocalDoublyLinkedList.size() / 2); x++) {
listOne.add(x, LocalDoublyLinkedList.getValue(x));
}
for (int x = (LocalDoublyLinkedList.size() / 2) + 1; x < LocalDoublyLinkedList.size`(); x++) {`
listTwo.add(x, LocalDoublyLinkedList.getValue(x));
}
//Split the DoublyLinkedList again
MergeSort sort1 = new MergeSort(listOne);
MergeSort sort2 = new MergeSort(listTwo);
sort1.sort();
sort2.sort();
merge(listOne, listTwo);
}
private void merge(DoublyLinkedList a, DoublyLinkedList b) {
int x = 0;
int y = 0;
int z = 0;
while (x < first.length && y < second.length) {
if (first[x] < second[y]) {
a[z] = first[x];
x++;
} else {
a[z] = second[y];
y++;
}
z++;
}
//copy remaining elements to the tail of a[];
for (int i = x; i < first.length; i++) {
a[z] = first[i];
z++;
}
for (int i = y; i < second.length; i++) {
a[z] = second[i];
z++;
}
}
}
I want to make a component that includes a list of integers as one of its serialized properties. I know I can't declare a TList<integer> as a published property, because it doesn't descend from TPersistent. I've read that you can define "fake" published properties if you override DefineProperties, but I'm not quite sure how that works, especially when it comes to creating a fake property that's a list, not a single value.
Can someone point me in the right direction?
I need help with my application where i save a bunch of words like more than 4000 words or more in a List<[class name].
My problem is, as the number of words increases, the process in saving it in the list seems to go slower and the application uses a lot more of memory. Can you give me an advise or alternative to do this without affecting the speed of the process?
Greetings,
I have a FlowDocument where List control is placed. Inside this list I have some ListItem. Is there any way to set some kind of Visibility for specific ListItem? I don't see a coressponding Property like Visibility for ListItem. When I set fontsize="0.1" then application hangs (it goes into infinite loop).
Hi, Python newbie here.
I have a list L = [a, b, c] and I want to generate a list of tuples :
[(a,a), (a,b), (a,c), (b,a), (b,b), (b,c)...]
I tried doing L * L but it didn't work. Can someone tell me how to get this in python.
I have:
L1 = ['11', '10', '13', '12', '15', '14', '1', '3', '2', '5', '4', '7', '6', '9', '8']
this is a list of strings, right?
I need to make it a list of integers as follows:
L2 = [11, 10, 13, 12, 15, 14, 1, 3, 2, 5, 4, 7, 6, 9, 8]
finally I will sort it like below:
L3 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] by L2.sort()
please let me know how I can get to L3 from L1
I want to get use of dictionary items like I do in List generic class,
e.g;
foreach(item in ItemList)
{
item.BlaBla;
}
but in dictionary there s no chance, like e method above...
Dictionary<string, HtmlInputImage> smartPenImageDictionary;
I mean I got to know the key item for the dictionary item.. but what I want, I want to travel from beginning of the list till the end..
What's the idiomatic way to do maximumBy (higher order function taking a comparison function for the test), on a list of lists, where the comparison we want to make is the sum of the list, in Python?
Here's a Haskell implementation and example output:
> maximumBy (compare `on` sum) [[1,2,3],[4,5,6],[1,3,5]]
> [4,5,6]
Hello i want to remove duplicates from a list
i do this but not working
List<Customer> listCustomer = new ArrayList<Customer>();
for (Customer customer: tmpListCustomer)
{
if (!listCustomer.contains(customer))
{
listCustomer.add(customer);
}
}
So I have a list of tuple like:
[(1,"juca"),(22,"james"),(53,"xuxa"),(44,"delicia")]
I want this list for a tuple whose number value is equal to something.
So that if I do search(53) it will return 2
Is is an easy way to do that?
I have a list like this:
[["str1","str2"],["str3","str4"],["str5","str6"]]
And I need to convert it to
["str1", "str2", "str3", "str4", "str5", "str6"]
How do I do this?
The problem is that I'm dealing with lists of strings, so when I do
lists:flatten([["str1","str2"],["str3","str4"],["str5","str6"]])
I get
"str1str2str3str4str5str6"
However, if the elements of the original list where just atoms, then lists:flatten would have given me what I needed. How do I achieve the same with strings?
Hello,
I've just discovered Sikuli, and would like to see a comprehensive functions list without digging through the online-examples and demos.
Has anyone found such a list?
Furthermore, apparently Sikuli supports more complex loops and function calls as well, and seems to be based in Python(!!). Examples would be great.
Thanks.
How would you write a list comprehension in python to generate a series of n-1 deltas between n items in an ordered list?
Example:
L = [5,9,2,1,7]
RES = [5-9,9-2,2-1,1-7] = [4,7,1,6] # absolute values
a=[1,2,3,4]
b=a.index(6)
del a[b]
print a
it show error:
Traceback (most recent call last):
File "D:\zjm_code\a.py", line 6, in <module>
b=a.index(6)
ValueError: list.index(x): x not in list
so i have to do this :
a=[1,2,3,4]
try:
b=a.index(6)
del a[b]
except:
pass
print a
but this is not simple,has any simply way ?
thanks
Is there a singular regular expression that can be used in, say, a text editor's search/replace dialog to reverse the order of the items in a list?
For instance, take this list:
First item
Second item
Third item
Select it in a text editor like EditPad, bring up the search and replace box, apply a regex (run as a loop or not) and turn it into:
Third item
Second item
First item
Can this be done?
Guys,
I have a sharepoint list and user will click 'start now' link in that list, then, I have to start a workflow. How this can be achieved. Please advice!
Thanking you.
I have webpage I downloaded with C++ to a string, and it is basically a massive list of links. I need to find the last 2 elements of the list. Can anyone help me on how to do this?
Hi,
i basically want to know the differences or advantages in using a generic list instead of an array in the below mentioned scenario
Class Employee
{
private _empName;
Public EmpName
{
get{return _empName;}
set{_empName = value;}
}
}
1. Employee[] emp
2. List<Employee> emp
can anyone please tell me the advantages or disadvaatges and which one to prefer
How can I ensure the contacts I add to an Outlook distribution list are displayed with both name and email address? These contacts may not exist in any other address book, just the distribution list. Currently they show up just as an email address (in both columns).
Here's roughly the VBA we're using:
Do Until RS.EOF
//here's where we want to inject RS!FirstName, RS!Surname etc
objRecipients.Add RS!Email
objRecipients.Resolve
RS.MoveNext
Loop
Set objDistList = contactsFolder.Items.Add("IPM.DistList")
objDistList.DLName = "Whatever"
objDistList.AddMembers objRecipients
objDistList.Save
etc
I want to display list of objects from database, and on the same page have option to edit them. When submitting, I'd like to submit changes to all of them.
I found this link: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx and http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx but there is no description how to handle posted data in controller.
Thanks in advance!