|
Well it looks like you have to look up the Huffman table for the image it's marked at:
DHT 0xFFC4 variable size Define Huffman Table(s) - Specifies one or more Huffman tables.
A bit more can be found about this at this site:
JPEG Huffman Coding Tutorial[^]
The wiki explains it a little also:
JPEG Wiki[^]
|
|
|
|
|
Hi
I am planning to implement a custom version control system.
Is there anyway to represent physical directory structure in database?
Or should I represent them using 'tree' data structure?
If using tree data structure, how can I save the contents of tree to an external file??
thanks
fadi
|
|
|
|
|
Yes,
I have done this quite often there are several ways of doing this, it mostly depends on how you plan on searching the db or how you want to maintain the data. The obvious approach is to use a column file directory:
c:\mydir\thisdir\nextdir\and-so-on
This can make it a head ache if you need indexing.
The approach I used for indexing is to use a treemap where I had two colums a and b; a is the parent and b the child. you can build a directory structure this way easily. The problem with this approach is using SQL with it. You have to load the whole tree in memory in a tree map in the application then modify it and post it back or update the 'dirty' sections after you make changes to the tree.
|
|
|
|
|
i have model for intrusion prevention system i want to simulte it
|
|
|
|
|
What does this have to do with an algorithm? If you can explain that you might get an answer to your question.
|
|
|
|
|
I am attempting to symbolically determine the roots of the 6th and 7th order Legendre polynomials. I started this task by tackling the 6th order polynomial as follows:
P6 = 1/16 * (231x^6 - 315x^4 + 105x^2 - 5)
I first started solving this equation by substituting u=x^2 and went down the path of solving the resulting cubic equation for u, then taking the square root to convert the solution back to x. The first solution I came up with was:
±√[2/33 * (120 - ∛{-15/7 * [751323 - 11√(-3442911)]} - ∛{-15/7 * [751323 + 11√(-3442911)]})]
However, this equation yields the value 0.23982861022165, but the known good value is 0.238619186083197[^]
I tested the result I am getting using the calculator found here[^], and got the same result as my symbolic solution above (be sure to take the square root of the result to convert back to values of x instead of u). Does anyone know why I am coming up with the wrong answer here? I would really appreciate some assistance, as I have grown tired of staring at my solution, searching for the problem. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Wednesday, January 13, 2010 4:32 PM
|
|
|
|
|
Nevermind... I'm just an idiot. Note to self: (x/16) * (16/y) != (16*x)/y
The solution is actually:
±√[1/3 * (15/11 - ∛{-40/9317 * [9 + 11√(-54)]} - ∛{-40/9317 * [9 - 11√(-54)]})]
Thanks to anyone who was planning to help,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
That is a really handy site! You wouldn't happen to know how to determine the roots of higher-order polynomials to n-significant figures, would you? For example, when I plug in the following Legendre polynomial, I only get the roots to 6-significant digits.
(46189x^10 - 109395x^8 + 90090x^6 - 30030x^4 + 3465x^2 - 63) / 256
I can't figure out how to run this query so I get the "more digits" option for the roots. This isn't really an algorithm question, but I figured you may have some insight since you recommended that site. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
Yes, there are a lot of really good math programs out there. if you know Python then go with Sage. If not I would go with Maximia.
~TheArch
|
|
|
|
|
Now ihave do this
select a from table_a where aa=123
select b from table_a where aa=32
select sum(aa) as c from table_a where aa=44
select sum(bb) as d from table_a where aa=88
i want to select them just use one SQL.not use union,because i want to show them like this :
a b c d
1 2 32 32
23 43 54 564
32 43 64 45
show four fields,not one,it's difficulty for me,i have done all day long,everyone who can teach me ?very apprciate!!
|
|
|
|
|
Cross posting is considered bad form here. Your question is SQL related and you've posted it the SQL forum.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hi
Is there any algorithm to check if a binary tree
(not BST,just a binary tree with max two childs for each parent)
is AVL tree?
Regards
|
|
|
|
|
|
An AVL tree's height will be limited to 1.44*Log2(n), so why not calculate the height and then if it is over the max height then it's not AVL.
Here is a PFD to calculate the height:
AVL Trees[^]
Hope this helps....
~TheArch
|
|
|
|
|
Hi there, I have an algorithm which searches a graph for Hamiltonian cycles. A graph is a bunch of nodes, with edges (connected with probability p each). A Hamiltonian cycle is a path along the edges from one node back to itself- passing through each node precisely once.
My algorithm currently does the following procedure:
starts at node 1
tries to increase the path to 2 vertices, call it 1,final node.
Algorithm:
if final node in path has a neighbour not already in the path, extend it by going to the first neigbhour it has in a list
if final node has no neighbours then remove final node and search the list of (final node - 1) for other potential neighbours.
(output if Path has length n and final node is connected to node 1)
This algorithm has a worst case complexity of n!. I.e if there n nodes and it visits everypath but can't find a hamiltonian cycle.
But what would be the average case running time given n and p?
|
|
|
|
|
Try your code using my Big O Algorithm Analyzer.
Big O Algorithm Analyzer for .NET[^]
It will show you the running time verses the n, you might have to create a Big O function to calculate p, I can't understand why this would be n! though.
Let me know if you need some help using the tool.
|
|
|
|
|
This can't be a new problem, but I don't see any code out there for it. An application I'm working on accepts input in Unicode, so most things work with Japanese characters, but there are a couple of names that I need to generate in ASCII. I have a base name to work from in Japanese (Hiragana or Katakana) and would like to use Hepburn or ISO_3602 romanization to convert into ASCII. There are various tables out there that I could use for this purpose, but I thought I'd check here first.
Has anyone out there solved this problem who's willing to share?
Thanks
|
|
|
|
|
Well, I have no knowledge on the language, but couldn't you just create a look-up method?
|
|
|
|
|
So far i have made the snake move about, eat randomly generated food pieces and the peices attach to the end of the snake, i need help on figuring out how to move the "segments" attached to the head of the snake.
For example a snake moving right works fine,
----->
But when i press down this happens:
|
|
|
V
When it should be:
-----
.....|
.....V (dots represent a space as this WYSIWYG doesn't allow me to have spaces)
Any ideas? Thanks
|
|
|
|
|
Hi,
1.
when you use PRE tags, you get a non-proportional font, and spaces work as you would expect.
2.
you need to hold the playground in memory, maybe as a 2-dimensional array of integers.
you could initialize it at all zero (=empty cells); then set one or a few cells to consecutive numbers (1,2,3,..N) where the highest number is the head and the lowest non-zero is the tail of the snake.
Moving it means adding the next number to the right/left/top/down position of the head, depending on current direction; and probably also removing the lowest non-zero, unless you want the snake to grow.
[CLARIFICATION ADDED]: in one dimension the snake could move
from 0 0 1 2 3 4 0 0 0
to 0 0 0 2 3 4 5 0 0
, so the head was 4 and now moved to 5, while the tail was 1 and moved to 2. You keep a pointer to the head and adjust it in the right direction; and you keep a pointer to the tail, search the neighbour that is one higher, and that becomes the tail.[/ADDED]
3.
and then you should visualize all this in the Paint handler, as I explained here[^].
modified on Wednesday, January 13, 2010 8:41 PM
|
|
|
|
|
I would actually store the snake's head index, tail index, and current direction. Then, store a 2D grid such that each cell can have one of three values: empty, snake, or new_segment, based on the contents of that cell. At each time step, move the head in the current direction by updating the head index, and test the value of that cell. If the value is "snake", there is a collision. If the value is "new_segment", draw the head, change the value to "snake", and continue to the next time step. Finally, if the value at the head index is "empty", erase the tail, search the four adjacent cells to find the one with a "snake" value (that isn't the head index), and set the tail index appropriately.
This approach has the following complexities:
Memory usage: O(grid_size)
Moving the snake: O(1) (assuming you use arrays with constant access time)
Redrawing the snake: O(1) (you only have to update at most two cells)
Testing for collisions: O(1) Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
I'm not sure that is good enough, if zero-gap meandering is allowed (it seems it is in such games), then the tail would not know where to go, as in:
0 0 0 0 0 0 0
0 1 4 5 6 7 0
0 2 3 0 0 0 0
where 7 is the head, 1 is the tail, and the problem is which square to vacate after 1 is vacated.
|
|
|
|
|
Ah... then perhaps there are still three states: empty=int.MaxValue, new_section=int.MaxValue - 1, and other=moveCount % (int.MaxValue - 1) (if it is not possible to have a game where int.MaxValue - 1 moves are made, then forget the modulus to save time. Also be sure that grid_height * grid_width < int.MaxValue - 1). Basically, I was trying to suggest the possibility that the number assigned to each cell was not necessarily the location of that cell in the snake. This allows a move to be performed in O(1) time instead of having to iterate through each snake segment and decrement it to reflect the snake segment on that tile. I think you were suggesting the same thing, but after reading your post I didn't know if that was clear to the OP or not, so I tried to expound upon it even though I probably just added to the confusion with my buggy approach. Thanks for the catch!
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|