traversal

How can i get the position number of an element?

混江龙づ霸主 提交于 2020-01-15 08:07:09
问题 Is there any plugin in firefox or function in firebug or something else, that lets me se the position number of a specific element? If i for example want to know the what position a specific TD element has compared to all the TD's in the document. EXAMPLE: <html> <head> <body> <table> <tr> <td></td> (0) <td></td> (1) <td></td> (2) <td></td> (3) <td></td> (And so on...) <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <------ WHAT IS THE POSITION NUMBER OF THIS

How can i get the position number of an element?

会有一股神秘感。 提交于 2020-01-15 08:05:10
问题 Is there any plugin in firefox or function in firebug or something else, that lets me se the position number of a specific element? If i for example want to know the what position a specific TD element has compared to all the TD's in the document. EXAMPLE: <html> <head> <body> <table> <tr> <td></td> (0) <td></td> (1) <td></td> (2) <td></td> (3) <td></td> (And so on...) <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <------ WHAT IS THE POSITION NUMBER OF THIS

How can you reverse traverse through a C# collection?

≯℡__Kan透↙ 提交于 2020-01-14 07:13:20
问题 Is it possible to have a foreach statement that will traverse through a Collections object in reverse order? If not a foreach statement, is there another way? 回答1: You can use a normal for loop backwards, like this: for (int i = collection.Count - 1; i >= 0 ; i--) { var current = collection[i]; //Do things } You can also use LINQ: foreach(var current in collection.Reverse()) { //Do things } However, the normal for loop will probably be a little bit faster. 回答2: You could just call Reverse()

HTTP TCP connection to web server behind NAT

五迷三道 提交于 2020-01-13 14:56:39
问题 My question is the same as this one but hopefully adds clarity to get an answer. After reading this fantastic article on the specifics behind NAT Traversal along with a general summary of methods found here, I'm wondering if the scenario has been accomplished or is possible. I'm writing software that serves web pages on any specified port, and am wondering if it is possible to have a web client from the WAN side connect to this server that is behind a NAT router. The reason this I'm finding

HTTP TCP connection to web server behind NAT

核能气质少年 提交于 2020-01-13 14:56:10
问题 My question is the same as this one but hopefully adds clarity to get an answer. After reading this fantastic article on the specifics behind NAT Traversal along with a general summary of methods found here, I'm wondering if the scenario has been accomplished or is possible. I'm writing software that serves web pages on any specified port, and am wondering if it is possible to have a web client from the WAN side connect to this server that is behind a NAT router. The reason this I'm finding

Median of BST in O(logn) time complexity

有些话、适合烂在心里 提交于 2020-01-12 08:28:22
问题 I came across solution given at http://discuss.joelonsoftware.com/default.asp?interview.11.780597.8 using Morris InOrder traversal using which we can find the median in O(n) time. But is it possible to achieve the same using O(logn) time? The same has been asked here - http://www.careercup.com/question?id=192816 回答1: If you also maintain the count of the number of left and right descendants of a node, you can do it in O(logN) time, by doing a search for the median position. In fact, you can

Jquery tree traversal - Nested Unordered list elements to JSON

孤街浪徒 提交于 2020-01-10 03:11:10
问题 Okay, Now I have an unordered list here: <ul id="mycustomid"> <li><a href="url of Item A" title="sometitle">Item A</a> <ul class="children"> <li><a href="url of Child1 of A" title="sometitle">Child1 of A</a> <ul class="children"> <li><a href="url of Grandchild of A" title="sometitle">Grandchild of A</a> <ul class="children"> <li><a href="url of Grand Grand child of A" title="sometitle">Grand Grand child of A</a></li> </ul> </li> </ul> </li> </ul> </li> <li><a href="url of Item B" title=

How to recursively go through list of lists and combine the lists in different ways

佐手、 提交于 2020-01-07 08:41:11
问题 This is a follow-up to this question. I have lists or "records" that are appended together into an empty list, that are each in the format (Matthew (AL 21 32)) . I am now trying to write a function that would use fetchRecord in order to find the desired record and then multiply the two numbers inside the record. However, my current code works only if I am getting the name on the first record but it returns an empty list for any record after that. Here is my code: (define (Mult_Num name) (cond

Python Trie: how to traverse it to build list of all words?

不羁岁月 提交于 2020-01-06 03:59:04
问题 I have created a trie tree as im learning python, here is the trie output {'a': {'b': {'c': {'_': '_'}}}, 'b': {'a': {'x': {'_': '_'}, 'r': {'_': '_', 'z': {'_': '_'}}, 'z': {'_': '_'}}}, 'h': {'e': {'l': {'l': {'o': {'_': '_'}}}}}} I am unable to list all the words back out of the trie, I'm obviously not understanding something simple, below is my code to create the trie and add to the trie as well as check if words are present in the trie. The method list is my poor attempt to list words,

How to handle a path in Prolog graph traversal

▼魔方 西西 提交于 2020-01-05 17:58:55
问题 I have written in Prolog: edge(x, y). edge(y, t). edge(t, z). edge(y, z). edge(x, z). edge(z, x). path(Start, End, Path) :- path3(Start, End, [Start], Path). path3(End, End, RPath, Path) :- reverse(RPath, Path). path3(A,B,Path,[B|Path]) :- edge(A,B), !. path3(A, B, Done, Path) :- edge(A, Next), \+ memberchk(Next, Done), path3(Next, B, [Next|Done], Path). Its taking care of cyclic graphs as well, I am getting an irregular output when I try to traverse same node from same node. eg: path(x,x,P).