bbs的树状算法的补充程序

2016-01-29 18:25 1 1 收藏

bbs的树状算法的补充程序,bbs的树状算法的补充程序

【 tulaoshi.com - ASP 】

  ssql = "select gorders,glayer from bbs where gId=" & gId & " and goders " & gorders & " order by goders  "
rs1.Open sql, conn1, adOpenForwardOnly, adLockOptimistic '查询比父贴
                                            ‘order_value大的order_value
If (rs1.EOF And rs1.BOF) Then
If gLayer = 8 Then  '如果深度大于8,就设goerders,glayer跟回帖平行
   gorders = rs1("gorders")
   gLayer = rs1("glayer")
Else
  gorders = gorders + 256
  gLayer = gLayer + 1
End If
Else
  nextvalue = rs1("gorders")
  If (nextvalue - gorders) 1 Then
   gorders = Int((gorders + nextvalue) / 2)
   gLayer = gLayer
  Else                             '跟跟贴平行
   gorders = rs1("gorders")
   gLayer = rs1("glayer")
End If
End If

 

来源:https://www.tulaoshi.com/n/20160129/1505690.html

延伸阅读
    首先,我们先看看这个游戏的规则,给出4个1-9之间的自然数,例如:1,5,5,5(这是很经典的一个例子哦 ^_^)。在1,5,5,5中间用+、-、*、/来运算后得到24这个数。每个数只能使用一次。如果没有计算过的基本都会被难住吧。哈哈,答案是 5*(5-1/5)。是不是很经典呢?和它类似的还有3,3,8,8。     下...
标签: ASP
  【bigeagle】 于 2000-12-6 14:38:50 加贴在 Joy ASP ↑:     bbs的树形结构显示可以有很多种方法,其中比较容易想到的是递归和排序串方法,但这两种方法并不是很好,那么怎 样才算是比较合理的算法呢?     递归方法不用讲,大家都知道怎么用,先讲讲排序串方法,最简单的排序串方法可以这...
标签: Web开发
  表A: 1-0-1,this is a test 3-1-1,this is a test 4-3-1,this is a test 5-3-1,this is a test 2-0-2,this is a test 上面是BBS主题列表的一个例子。一般来说,假如不是使用Oracle(Oracle 有一条查询语句可以自动生成家族树,请查阅Select ... start  with ... connect by ...语句),那么如何实现上例的列表是一件费事的工...
已知一棵二叉树按顺序方式存储在数组 A[1..n]中。设计算法求出下标分别为 i 和 j 的两个结点的最近的公共祖先结点的值。 武汉大学2000年第五(1)题(8’) #inlcude stdio.h parent(int A[],int i,int j) {int k,m; m=k=0; if(i==1j==1A[i]==0A[j]==0i==j) // A[i]==0或A[j]==0表示不存在该结点 ...
  unit Crc32; interface                                               &...

经验教程

883

收藏

40
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部