当min为-inf时,Redis zrangebyscore性能

时间:2019-01-11 11:13:51

标签: redis time-complexity

zrangebyscore的时间复杂度为O(Log(N))

如果我使用min = -inf并限制1运行zrangebyscore会降低O(log(n))吗?或O(1)?

1 个答案:

答案 0 :(得分:0)

library(rhandsontable) library(shiny) ui <- fluidPage( mainPanel( rHandsontableOutput("hot") ) ) server = function(input, output, session){ df <- data.frame(a = rnorm(10), b = rnorm(10)) values <- reactiveValues(data = df) observeEvent( input$hot$changes$changes, # observe any changes in the cells of the rhandsontable { column_index =input$hot$changes$changes[[1]][[2]] # get the index of the column that was changed values$data <- hot_to_r(input$hot) if(column_index == 1){ output$hot <- renderRHandsontable({ rhandsontable(values$data) %>% hot_col('a', readOnly = T) }) } else{ output$hot <- renderRHandsontable({ rhandsontable(values$data) %>% hot_col('b', readOnly = T) }) } } ) output$hot <- renderRHandsontable({ rhandsontable(values$data) }) } shinyApp(ui, server) O(Log(N)+ M),其中“ N”是排序集中的元素数,“ M”是要返回的元素数。

因此,您的复杂度计算需要考虑集合中元素数量加1的对数。

ZRANGEBYSCORE - Redis Documentation